Can I force a page break based on when the value of a column ?

Stimulsoft Reports.WEB discussion
Stephane
Posts: 7
Joined: Sun Jan 15, 2023 11:25 am

Can I force a page break based on when the value of a column ?

Post by Stephane »

I have a need to insert "optional page break" in my report based on the source data. Currently my report is generated using a single (page) header and data line.

Basically, I woul like the report engine to add a page break either when the value of a given data column changes or when it is set to a specific value (either solution will work for me).

Any suggestion?
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Can I force a page break based on when the value of a column ?

Post by Lech Kulikowski »

Hello,

You can use the following code in the BeforePrint event:
if (yourcondition)
Engine.NewPage();

Thank you.
Stephane
Posts: 7
Joined: Sun Jan 15, 2023 11:25 am

Re: Can I force a page break based on when the value of a column ?

Post by Stephane »

Thank you for your answer. Unfortunately, it doesn't seem to be working.
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Can I force a page break based on when the value of a column ?

Post by Lech Kulikowski »

Hello,

That should work in the NET-based and JS products.

Thank you.
Stephane
Posts: 7
Joined: Sun Jan 15, 2023 11:25 am

Re: Can I force a page break based on when the value of a column ?

Post by Stephane »

Well, it doesn't seem to work in the designer's preview (web or local). I have opened a support case for this. Thank you for your help :)
Stephane
Posts: 7
Joined: Sun Jan 15, 2023 11:25 am

Re: Can I force a page break based on when the value of a column ?

Post by Stephane »

I found the problem. Apparently, this script doesn't work in "interpretation" mode. Thank you again for your help.
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Can I force a page break based on when the value of a column ?

Post by Lech Kulikowski »

Hello,

You are welcome.
nmortier
Posts: 5
Joined: Tue Mar 28, 2023 8:16 am

Re: Can I force a page break based on when the value of a column ?

Post by nmortier »

Hello,

I tried this BeforePrintEvent on a Panel (containing a simple shape). The condition is "if(IsFirstPage) Engine.NewPage();".
The new page is correctly created during preview, but it's a complete copy of the first page.
I was expecting to only have the Panel (and the components after it) on the new page.

Is this the correct behaviour ?

Thank you
Lech Kulikowski
Posts: 6237
Joined: Tue Mar 20, 2018 5:34 am

Re: Can I force a page break based on when the value of a column ?

Post by Lech Kulikowski »

Hello,

Please send us a sample report with test data for analysis.

Thank you.
nmortier
Posts: 5
Joined: Tue Mar 28, 2023 8:16 am

Re: Can I force a page break based on when the value of a column ?

Post by nmortier »

You can find the sample attached.

It's quite simple without any data. It only contains shapes and subreport.
Attachments
BeforePrintEventPageBreak.mrt
(5.23 KiB) Downloaded 79 times
Post Reply