Home
Analytics
Controlling repeated table header
anezch
Hi,
I'm new to BIRT and I'm using standard BIRT report viewer deployed on a tomcat server. When I export the reports, I get different results regarding to the table header:
1. HTML view: repeated every page (40 rows)
2. XLS: not repeated
3. ODS: repeated every 40 rows
I want to enable repeated table header in the html view, and not in XLS and ODS exported report. I tried to add script to reports' beforeRender method to check output type and set the repeatHeader property accordingly but it's not working. I read the BIRT's table element reference and I found that repeatHeader property is not runtime settable.
What is the correct way to do this?
Find more posts tagged with
Comments
kclark
You can use repeateHeader in your tables onCreate() like this<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>if(reportContext.getOutputFormat() != "pdf") {
this.repeatHeader = false;
}</pre>
<br />
Or if you are wanting to set it in onPrepate() you can use<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>this.setRepeatHeader(false);</pre>
anezch
Hi, kclark! Thank you for your response. I tried both methods, but the results are still the same. Here's my code on the table's onCreate method:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
rh = false;
format = reportContext.getOutputFormat().toLowerCase();
if (format.equals("pdf") || format.equals("html")) {
rh = true;
}
this.setRepeatHeader(rh);
</pre>
<br />
I'm using birt report viewer example webapp supplied in the birt runtime package. When the report displayed in the webapp, the table header is repeated on each page. And when I export the report to ODS with the button on the toolbar, the table header is still repeated every 40 rows (as set in page break interval).<br />
<br />
I suspect the onCreate script was not executed when the report exported to ODS (or any format). When i set rh to false in the if block, the table head in both reports displayed in the webapp and exported ODS is not repeated.<br />
<br />
Thanks,