Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Display master page footer on last page only with DE API
urabirt
<p>Hi,</p>
<p> </p>
<p>I'm designing a report with Design Engine API. In my report, I must display a label only at the end of the report's last page. To perform this, I tried to define a master page, assign it to "masterPage" property of the last row of the grid in the report, and add the master page to the global design. But the footer appears on every page of my report, which is not what I want, instead I want it to be visible only on the last page of my report. Below is the code I used, can you tell me what I did wrong? My grid displays can display on several pages, depending on content read from a dataSet. with page break correctly managed.</p>
<p> </p>
<p>Thanks for your help</p>
<p> </p>
<p> </p>
<p><b>final</b> SimpleMasterPageHandle masterPage = factory.newSimpleMasterPage("Page Master");</p>
<p>design.getMasterPages().add(masterPage);</p>
<p><b>final </b>GridHandle gridHandle = factory.newGridItem("main grid", 2, 4);</p>
<p>design.getBody().add(grid);</p>
<p><b>final</b> RowHandle lastRow = (RowHandle) grid.getRows().get(3);</p>
<p>lastRow.setProperty("masterPage", masterPage.getName());</p>
<p><b>final</b>StyleHandle style = label.getPrivateStyle();</p>
<p>style.setProperty(StyleHandle.<b><i>FONT_FAMILY_PROP</i></b>, ARIAL_FONT);</p>
<p>style.setTextAlign(DesignChoiceConstants.<b><i>TEXT_ALIGN_CENTER</i></b>);</p>
<p>label.setText("my label");</p>
<p>masterPage.getPageFooter().add(label);</p>
<p> </p>
Find more posts tagged with
Comments
JFreeman
<p>As long as you use separate run and render tasks for generating the report, you can add some script into the onRender of the label in the master page to hide it on every page except for the last.</p>
<p> </p>
<p>For example:</p>
<pre class="_prettyXprint _lang-js">
label.setOnRender("if(pageNumber < totalPage){this.getStyle().display = \"none\";}");
</pre>
urabirt
<p>Thanks Jesse,</p>
<p> </p>
<p>could you show a code sample illustrating how to separate run and render tasks. In my case, I think I do not separate these tasks, as I use the api :</p>
<p> </p>
<p>design = engine.openReportDesign(myReportDesign);</p>
<p>IRunAndRenderTask task = engine.createRunAndRenderTask(design);</p>
<p>task.run():</p>
<p> </p>
<p>Thanks a lot</p>
JFreeman
<p>Take a look at this documentation page on the Report Engine API: <a data-ipb='nomediaparse' href='
https://eclipse.org/birt/documentation/integrating/reapi.php'>https://eclipse.org/birt/documentation/integrating/reapi.php</a></p>
;
<p> </p>
<p>Is includes samples for separate run and render tasks.</p>
urabirt
<p>worked like a charm</p>
<p> </p>
<p>Thanks</p>
JFreeman
<p>You're welcome.</p>
<p> </p>
<p>Let us know if you have additional questions.</p>