Page 1 of 1

No text on StiText created from code

Posted: Tue Jan 23, 2024 11:45 am
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 2767 times

Re: No text on StiText created from code

Posted: Tue Jan 23, 2024 9:57 pm
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.

Re: No text on StiText created from code

Posted: Wed Jan 24, 2024 5:51 am
by mrapi
k.thanks

Re: No text on StiText created from code

Posted: Wed Jan 24, 2024 8:08 am
by Lech Kulikowski
Hello,

You are welcome.

Re: No text on StiText created from code

Posted: Thu Jan 25, 2024 10:06 am
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()

Re: No text on StiText created from code

Posted: Thu Jan 25, 2024 10:46 am
by Lech Kulikowski
Hello,

Thank you for the information.

Re: No text on StiText created from code

Posted: Thu Jan 25, 2024 11:11 am
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