Adding pages to a mrt-template from code

Stimulsoft Reports.NET discussion
Post Reply
gunde99
Posts: 27
Joined: Tue Jul 31, 2012 11:23 am

Adding pages to a mrt-template from code

Post by gunde99 »

Hi!

I'm loading a mrt-file in a C#-project and are trying to add pages before compiling, rendering and exporting to pdf. The page gets added but is empty. What am I missing?

I've attached both the code and the mrt-file.
Attachments
Report_test.mrt
(3.31 KiB) Downloaded 383 times
CreateReport.cs
(14.22 KiB) Downloaded 230 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Adding pages to a mrt-template from code

Post by HighAley »

Hello.

Please, send us a working project which reproduces the issue for analysis.

Thank you.
gunde99
Posts: 27
Joined: Tue Jul 31, 2012 11:23 am

Re: Adding pages to a mrt-template from code

Post by gunde99 »

Hi!

You've allready had all the code in the CreateReport.cs, attached in my first post, but I made a full working project. Just put the Report_test.mrt-file in C:\Temp\Stimulsoft\ or change the path in Form1.cs.

Thanks
Attachments
StimulsoftTest.zip
(2.08 MiB) Downloaded 269 times
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Adding pages to a mrt-template from code

Post by Alex K. »

Hello,

Please try to change the following code:

Code: Select all

public StiPage CreateNewPage(String name, StiReport report)
{
    \\StiPage p = new StiPage();
    StiPage p = new StiPage(report);
    ...
Thank you.
gunde99
Posts: 27
Joined: Tue Jul 31, 2012 11:23 am

Re: Adding pages to a mrt-template from code

Post by gunde99 »

Fantastic! That showed the objects but still no text in the boxes. So used the same strategy and instead of using the empty constructor, to create the textboxes, I sent in a rectangle and the text. That made the difference and now everything works as intended.

Thank you very much and happy New Year!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Adding pages to a mrt-template from code

Post by Alex K. »

Hello,

Great!
Let us know if you need any additional help.

Happy New Year!!
Post Reply