|
Re: Page number and total page [message #774831 is a reply to message #774451] |
Wed, 04 January 2012 18:00 |
|
Can you use a text element and set its type to html and put in the
following expression:
<viewtime-value-of>
pageNumber
</viewtime-value-of>
Jason
On 1/3/2012 6:52 PM, Jason Nguyen wrote:
> I have a requirement to add page number and total page to the report
> directly, which is a form. I copy and paste those 2 fields from master
> page over the report. The total page shows the correct value; however,
> the current page always shows a value of one. Is there anything I need
> to setup to get it working correctly?
> Thanks,
|
|
|
|
Re: Page number and total page [message #774882 is a reply to message #774864] |
Wed, 04 January 2012 20:57 |
|
Did you set the type to html? What version of BIRT are you using?
On 1/4/2012 3:01 PM, Jason Nguyen wrote:
> I did exactly what you said and I see the "pageNumber", not the
> numerical page number value.
|
|
|
|
Re: Page number and total page [message #774894 is a reply to message #774888] |
Wed, 04 January 2012 21:30 |
|
Sorry,
View-Time value of was not available until BIRT 2.6. I am not certain
if <VALUE-OF>pageNumber</VALUE-OF> will work but you could give it a try.
Jason
On 1/4/2012 4:10 PM, Jason Nguyen wrote:
> Version 2.3.2. Yes, I set it to HTML.
|
|
|
|
Re: Page number and total page [message #774935 is a reply to message #774902] |
Thu, 05 January 2012 00:11 |
|
pageNumber is a reserved name but works on the layout in later versions
of BIRT. It has to be viewed using the frameset mapping (separate run
and render task). This is where the variable gets incremented.
Jason
On 1/4/2012 5:00 PM, Jason Nguyen wrote:
> After I changed to <VALUE-OF>pageNumber</VALUE-OF>
> I get 1's in all the header pages of the form. Is pageNumber a reserved
> name in Birt? Is it tied to a particular field at all? How does that
> variable get incremented in Birt? Thanks.
|
|
|
|
Re: Page number and total page [message #775283 is a reply to message #775227] |
Thu, 05 January 2012 18:03 |
|
How are you viewing the report? With the web viewer using the frameset
mapping?
Jason
On 1/5/2012 10:42 AM, Jason Nguyen wrote:
> Are you saying version 2.3.2 has a bug that pagenumber is not working?
> Is there a way that I can get around this bug?
|
|
|
|
Re: Page number and total page [message #775322 is a reply to message #775316] |
Thu, 05 January 2012 19:07 |
|
I am attaching a 3.7 report. Look at the green field. BTW in the
designer it does not work correctly when previewing directly to pdf. I
first preview in the web viewer and then export to pdf and it works.
This is because view in pdf uses a runandrender task as opposed to run
task then a separate render task. Page scripts have to have separate tasks.
Jason
On 1/5/2012 1:59 PM, Jason Nguyen wrote:
> I am viewing the report in pdf. Do you have a sample code somewhere?
> What version of Birt the pageNumber is working properly?
|
|
|
Re: Page number and total page [message #1067972 is a reply to message #774451] |
Thu, 11 July 2013 13:47 |
Henning von Bargen Messages: 23 Registered: May 2011 |
Junior Member |
|
|
I try to avoid everything page-numbering related with BIRT itself, as it is all buggy (e.g. it doesn't work at all with RunAndRenderTask, and separate RunTask and RenderTask breaks pagination...) (see e.g. a Bugzilla entry by yaytay).
Intead, we are using a PostProcessor:
The BIRT Report tells the PostProcessor where, in which format, and under which conditions the page numbering should be added.
This is a bit ugly when designing the report (as the position has to be fixed, e.g. it is impossible to do this in a flow text), but it is working fine for all the reports we developed until now.
Features:
BIRT can feed the PostProcessor with several of "PageNumberingInstructions".
Each one has the following information:
- Font (Name, Bold?, Italic?, ptSize)
- Format e.g. "Page {0} of {1}"
- Rect (absolute position on the page in PDF units)
- Alignment Left/Right/Center
- Condition as a Javascript expression, e.g. "page==1" or "page>1"
- ResetAtLevel (optional)
As a special feature, the PostProcessor uses the PDF Outline (Table-of-Contents in BIRT-speech) to find out about grouping information. Inside the Format and the Condition, the PostProcessor can use this information.
With "ResetAtLevel", you can reset the page numbering to 1 whenever a TOC entry of the given level (or lower) changes.
With "{2}" in the Format, you can display the Outline/TOC Root (level 0) text, with "{3}", you can display the current text for TOC level 1, "{4}" is the current TOC level 2 text and so on.
This allows a "grouped page numbering".
E.g. if the TOC is like this:
My Report physical page
Preface 1 .. 3
Chapter 1 4 .. 8
Section 1 4 .. 6
Section 2 7 .. 8
Chapter 2 9 .. 10
Section 1 9
Section 2 9 .. 10
Say, you want the page-numbering only for the actual content, not for the preface, and it should show only the page inside the current chapter in the page header.
You also want to display the current Chapter and Section centered in the page footer.
Then you could use this:
// First instruction, for the Page-Numbering
.Font = ...;
.Format = "Page {0} of {1}";
.Rect = ...;
.ResetAtLevel = 1; // for each chapter
.Condition = "context[1].substring(0,6) == 'Chapter'";
// Inside the preface, this is false, while true inside the chapters
// Next instruction, for the current Chapter and Section text
.Font = ...;
.Format = "{3} - {4}";
// {2} is TOC context level 0 (My Report), {3} is TOC context level 1 (Chapter ...)
// and so on
.Rect = ...;
.Condition = "context[1].substring(0,6) == 'Chapter'";
// Inside the preface, this is false, while true inside the chapters
If anyone is interested, please contact me via www.t-p.com (ask for Henning)
Of course it would be better if BIRT supported this out of the box...
[Updated on: Thu, 11 July 2013 13:48] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02737 seconds