Home
Analytics
Page break based on the export format.
srijit
Hi,
I have a report whose number of rows are dynamic. It ranges from 0 to few thousands. I am now using the default page break of 40. This becomes a problem while exporting. In word and pdf formats, these 40 rows do not fit in a page and the header appears only after 40 records.so, if 39 records fit in one page, the 40th record appear in the next page. The rest of the page is blank and the 41st record starts from a new page along with the header.
This looks absurd when the number of rows are huge. I observed that when the page break is set to 0, the issue could be avoided in the exports (word and pdf). But, the html output displays all the 1000 records in the single page thus making the user to scroll down all the way to see the last record.Is there a way to dynamically set the page break based on the output format. Any javascript to solve the problem would be useful. Also, please mention where exactly i should place the javascript.
Thank You.
Regards,
Srijith.
Find more posts tagged with
Comments
mwilliams
Hi Srijith,
You can find the output format by using the following script:
reportContext.getOutputFormat()
I'm looking into the page break interval. It's a property of the table named pageBreakInterval, but I'm not seeing where to set it in script right off the bat. I think I've done it before, but I'll have to find it again. I'll let you know.
mwilliams
Can set pageBreakInterval with this:
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("tableName").setProperty("pageBreakInterval",40);
This is done in beforeFactory and you need to name your table in the property editor so you can grab it.
Hope this helps.
srijit
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="74372" data-time="1299509967" data-date="07 March 2011 - 07:59 AM"><p>
Hi Srijith,<br />
<br />
You can find the output format by using the following script:<br />
<br />
reportContext.getOutputFormat()<br />
<br />
I'm looking into the page break interval. It's a property of the table named pageBreakInterval, but I'm not seeing where to set it in script right off the bat. I think I've done it before, but I'll have to find it again. I'll let you know.
<br /></p></blockquote>
<br />
Thank You Williams.<br />
<br />
I used the below piece of code.<br />
<strong class='bbc'>if(reportContext.getOutputFormat().equalsIgnoreCase("HTML")){<br />
reportContext.getReportRunnable().designHandle.getDesignHandle().findElement("Report_Table").setProperty("pageBreakInterval",40);<br />
}</strong><br />
<br />
Still the same issue is existing. I had put this in the beforefactory. I want the page break to happen after the 40th record in my generated report. But when i export, i want the page break interval to be set as 0.
CBR
what do you mean by export?<br />
What you have done with your code is to set the page break interval to 40 for table Report_table and output format html.<br />
What's the original value of page break interval for table Report_table?<br />
I would suggest to change the original value to 0 and overwrite it for PDF with following code in the beforeRender event:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(reportContext.getOutputFormat()=="pdf") {
reportContext.getDesignHandle().findElement("Report_Table").setProperty("pageBreakInterval",40);
}
</pre>
srijit
<blockquote class='ipsBlockquote' data-author="'CBR'" data-cid="74428" data-time="1299578807" data-date="08 March 2011 - 03:06 AM"><p>
what do you mean by export?<br />
What you have done with your code is to set the page break interval to 40 for table Report_table and output format html.<br />
What's the original value of page break interval for table Report_table?<br />
I would suggest to change the original value to 0 and overwrite it for PDF with following code in the beforeRender event:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if(reportContext.getOutputFormat()=="pdf") {
reportContext.getDesignHandle().findElement("Report_Table").setProperty("pageBreakInterval",40);
}
</pre></p></blockquote>
<br />
In my piece of code i am over writing the page break interval to 40, when the output is of html format. I had set the original page break interval of the table to 0.<br />
My problem is, when i export the report using the "export report" option in the toolbar section, the report is not re run. Thus, the pagebreak interval that is present in the generated report(in the birt viewer) is used in the exported report too. <br />
If i could reset the page break interval after the report is run, it might solve the issue.