Page 1 of 2
Can I force a page break based on when the value of a column ?
Posted: Fri Mar 31, 2023 12:10 pm
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?
Re: Can I force a page break based on when the value of a column ?
Posted: Sat Apr 01, 2023 2:23 pm
by Lech Kulikowski
Hello,
You can use the following code in the BeforePrint event:
if (yourcondition)
Engine.NewPage();
Thank you.
Re: Can I force a page break based on when the value of a column ?
Posted: Mon Apr 03, 2023 12:49 pm
by Stephane
Thank you for your answer. Unfortunately, it doesn't seem to be working.
Re: Can I force a page break based on when the value of a column ?
Posted: Mon Apr 03, 2023 8:47 pm
by Lech Kulikowski
Hello,
That should work in the NET-based and JS products.
Thank you.
Re: Can I force a page break based on when the value of a column ?
Posted: Tue Apr 04, 2023 6:45 am
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
![Smile :)](./images/smilies/icon_e_smile.gif)
Re: Can I force a page break based on when the value of a column ?
Posted: Tue Apr 04, 2023 6:52 am
by Stephane
I found the problem. Apparently, this script doesn't work in "interpretation" mode. Thank you again for your help.
Re: Can I force a page break based on when the value of a column ?
Posted: Tue Apr 04, 2023 9:44 am
by Lech Kulikowski
Hello,
You are welcome.
Re: Can I force a page break based on when the value of a column ?
Posted: Tue Jun 27, 2023 4:20 pm
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
Re: Can I force a page break based on when the value of a column ?
Posted: Thu Jun 29, 2023 9:30 am
by Lech Kulikowski
Hello,
Please send us a sample report with test data for analysis.
Thank you.
Re: Can I force a page break based on when the value of a column ?
Posted: Thu Jun 29, 2023 12:32 pm
by nmortier
You can find the sample attached.
It's quite simple without any data. It only contains shapes and subreport.