Page N of M [message #662999] |
Fri, 01 April 2011 17:24  |
Eclipse User |
|
|
|
Hi All
I'm trying to put in the footer of my master page the variables Page and TotalPageCount
So for that I add a grid with just one column one row, then I aligned it to the left..I was able to do that, but it shows like this
1
of
1
I want this instead 1/1
If I use Page n of m i got something like this
1 of 1
I couldn't get rid of the spaces ....
Thanks in advance for your help.
JulioC.
|
|
|
|
|
|
|
|
Re: Page N of M [message #670446 is a reply to message #663519] |
Sat, 14 May 2011 01:05  |
Eclipse User |
|
|
|
JulioC wrote on Tue, 05 April 2011 09:26Jani wrote on Tue, 05 April 2011 01:14JulioC wrote on Fri, 01 April 2011 17:24I'm trying to put in the footer of my master page the variables Page and TotalPageCount
Where do you find those Page and TotalPageCount variables ? I tried to search BIRT Report Designer help without success.
I also found following code snippet:
<page-footer>
<text id="403">
<property name="textAlign">right</property>
<method name="onRender">
this.text = "Page " + pageNumber + " of " + totalPage;
</method>
<property name="contentType">html</property>
</text>
</page-footer>
No idea where those pageNumber and totalPage comes from or how to build such footer with Report Designer thought.
Yes the top fragment will work when you attach this on the footer of
the master page, under scripting , and onRender event. Equivalently this code
is similar to something I wrote here
public void createPageFooterUsingScripting() throws SemanticException{
SimpleMasterPageHandle masterPageHandle = design.getElementFactory().newSimpleMasterPage(null);
GridHandle footerGrid = design.getElementFactory().newGridItem(null/* name */,1 , 1 );
ColumnHandle colHandle = (ColumnHandle) footerGrid.getColumns().get(0);
RowHandle row01 = (RowHandle) footerGrid.getRows().get(0);
CellHandle cell1 = (CellHandle) row01.getCells().get(0);
TextItemHandle textItem = design.getElementFactory().newTextItem(null);
textItem.setProperty(DesignChoiceConstants.CHOICE_TEXT_ALIGN, DesignChoiceConstants.TEXT_ALIGN_RIGHT);
textItem.setContentType(DesignChoiceConstants.TEXT_CONTENT_TYPE_HTML);
String pageFooterExpression = "this.text = \"Page \" + pageNumber + \" of \" + totalPage ";
textItem.setOnRender(pageFooterExpression);
cell1.getContent().add(textItem);
masterPageHandle.getSlot(ISimpleMasterPageModel.PAGE_FOOTER_SLOT).add(footerGrid);
design.getMasterPages().add(masterPageHandle);
}
|
|
|
Powered by
FUDForum. Page generated in 0.06583 seconds