No text on StiText created from code

Stimulsoft Reports.NET discussion
Post Reply
mrapi
Posts: 282
Joined: Sat Dec 20, 2008 1:08 am

No text on StiText created from code

Post by mrapi »

Hi
I'm using stimulsoft 2024.1.3 with NET 4.7
I've created a report with a title band (ReportTitleBand1) then save it as compiled dll (Report1.dll)
then from cod I've added a StiText:

Code: Select all

        Dim wRp = StiReport.GetReportFromAssembly("d:\NET4\Report1.dll")
        Dim tx = New StiText(New RectangleD(0, 0, 5, 0.5))
        tx.Text = "My text"
        tx.HorAlignment = StiTextHorAlignment.Center
        tx.Name = "HeaderText"
        tx.Brush = New StiSolidBrush(Color.LightGreen)
        DirectCast(wRp.GetComponents("ReportTitleBand1"), StiReportTitleBand).Components.Add(tx)


        wRp.Render()
        wRp.Show()
report is shown but there is no text on create StiText just a ligh green rectangle
what I'm doing wrong?
thanks





2024-01-23 13_46_32-Window.png
2024-01-23 13_46_32-Window.png (8.21 KiB) Viewed 2763 times
Lech Kulikowski
Posts: 7334
Joined: Tue Mar 20, 2018 5:34 am

Re: No text on StiText created from code

Post by Lech Kulikowski »

Hello,

It is not possible, to add components in the already compiled report, you should add it in the template, and then compile it.

Thank you.
mrapi
Posts: 282
Joined: Sat Dec 20, 2008 1:08 am

Re: No text on StiText created from code

Post by mrapi »

k.thanks
Lech Kulikowski
Posts: 7334
Joined: Tue Mar 20, 2018 5:34 am

Re: No text on StiText created from code

Post by Lech Kulikowski »

Hello,

You are welcome.
MatthiasU
Posts: 68
Joined: Mon Sep 14, 2015 8:33 am

Re: No text on StiText created from code

Post by MatthiasU »

Hello,

Please try this:

1) load the original mrt-file
_rep = new StiReport();
_rep.Load(filename);
2) load compiled report
_rep.CompiledReport = StiReport.GetReportFromAssembly(pathToAssembly);
3) add your components
4) _rep.Render()
5) _rep.Show()
Lech Kulikowski
Posts: 7334
Joined: Tue Mar 20, 2018 5:34 am

Re: No text on StiText created from code

Post by Lech Kulikowski »

Hello,

Thank you for the information.
mrapi
Posts: 282
Joined: Sat Dec 20, 2008 1:08 am

Re: No text on StiText created from code

Post by mrapi »

Hi
I'm only deploying compiled report file,in this case _rep.Load(filename) would not work for me

thanks

MatthiasU wrote: Thu Jan 25, 2024 10:06 am
Post Reply