Home
Analytics
Table footer at the end of the last page
MagnusTide
Greetings,
I have a trouble designing a report for one of our customers.
First of all the technology we're using:
BIRT 2.3.0 (2.2.0)
output PDF A4 paper size
dataSource is XML file filled with data from an ERP system our customer is using
It's a report of an invoice and because they have been using other technology than BIRT for quite some time, the invoice has to look exactly the same like the old one.
Report is supposed to look like this:
1) there is a header with company address, customer addresss, bank accounts etc. which is supposed to be displayed on the top of every single page. We put that in the table header instead of a master page header cos' we needed to display multi line text which is being loaded via script to dynamic text component.
2) then there is one detail row which displays the content of the invoice
3) then there is a footer which should be at the end of the last page
We came up with one solution which we originally had thought would have worked. The header of the table has set it's height to a specific number and so does the detail row and the footer.
So far I've discovered that BIRT ignores the size of the detail row unless it's the last page. In other words if there are enough lines inside the detail row it's rendering to the end of the page if ther aren't the line is the size we set it to be. The original idea was that BIRT wouldn't display the footer on more than on page so because of the size of the detail row it will always be at the end of the last page. But when there are enough lines in detail row so the footer wouldn't fit on one page it's just half on one and half on another page. I've also tried to use BIRT 2.2.0 where Inside pageBreak is actually working but it'll just put the whole footer in the middle of next page (after the header).
Today I came up with an idea of checking the onPageBreak method of the footer which has pageBreakInside set to Avoid (now in 2.2.0). When this method is fired I set the value of a variable. Next thing I have a table with two rows in this footer - first is blank, second is content (what is supposed to be in footer); and I'm trying to set the table margin Top or the size of the blank row in order to put the content of the footer to the end of the page. It seems that if I set the row height onCreate it will put the footer at the end of the page but pageBreak occurs even if the footer fits on the previous page (I guess it thinks that the row is the size set in script which shouldn't execute until the pageBreak of the footer occurs). When I put this script to onPrepare method it doesn't work at all.
Can ANYBODY advise? Because the footer displays the sum of all lines in the invoice, tax and signature etc. It can't be displayed in master page footer (it would be on every single page). I can upgrade/downgrade to any version of BIRT if it'll help. However inside pageBreak is still not working in 2.5 M5 I think.
Unfortunatelly I can't probably post rptdesign or the XML since it is the actual invoice of our customer. If the layout or the explanation woun't be clear (it's quite complicated to describe it in details) I'll post some screens instead.
THANK YOU IN ADVANCE
Magnus
Find more posts tagged with
Comments
mwilliams
Hi Magnus,<br />
<br />
You may have already found a solution to this, but if your detail rows are all the same height, something like the idea from the following devShare post would probably do what you're wanting.<br />
<br />
<a class='bbc_url' href='
http://www.birt-exchange.org/devshare/designing-birt-reports/989-extend-table-to-fit-page/#description'>Extend
Table to Fit Page - Designs & Code - BIRT Exchange</a>
qos
Hello,
We are working with birt 3.7, and have exactly the same question, an invoice that we want to have table footer at the bottom of the page. The solution given is not the best since we can't set a height to our table detail nor specify page break.
Didn't find anything more than this post or that solution. Is there any other solution?
Thanks in advance
Teresa
mwilliams
In 3.7, you wouldn't have to specify the page break. The bug from the earlier versions is no longer there. Page break events are called on natural page breaks. So, the only obstacle you'd be left with is not having a fixed detail row height. You could compute your way around this by figuring out how many lines the number of characters in your row would cause given your font and column width. This would just be a guestimation though. Would using the page footer to display the desired information at the bottom of the last page work for you?
qos
Hello,
Thank you for your help.
Yes, we are using natural page break. It was one of the reasons the solution didn't seem to be the right one... but perhaps i got it wrong. Anyway, fixed detail row height is not a possibility ...
Page footer has always the problem of reserving the space, or not?...
Thank you!
mwilliams
The page footer would have to be sized appropriately, yes. I don't believe it would expand based on your data for the last page. What does the "table footer" data consist of? Is it more than just one line, I'm guessing? There has been talks of creating the feature to allow you to switch masterpages within a table. This would help in your case, with the mp footer, but it's not made it into BIRT yet. A script that estimates the number of lines per row and adds them together might be good enough to work for you.
qos
Thank you Michael,
Yes, "table footer" consists of two blocks of information, like a grid with 2 columns and 4/5 lines. Hopping that switching master pages within a table be available soon
We will try other approaches then, considering your script idea.
Thanks for your help.
Teresa
Megha Nidhi Dahal
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="84394" data-time="1319133282" data-date="20 October 2011 - 10:54 AM"><p>
In 3.7, you wouldn't have to specify the page break. The bug from the earlier versions is no longer there. Page break events are called on natural page breaks. So, the only obstacle you'd be left with is not having a fixed detail row height. You could compute your way around this by figuring out how many lines the number of characters in your row would cause given your font and column width. This would just be a guestimation though. Would using the page footer to display the desired information at the bottom of the last page work for you?<br /></p></blockquote>
Hi,<br />
<br />
Sorry for jumping into the thread.<br />
<br />
I'm not getting any event in 3.7 also that gets consistently fired on every page break. I also have a similar requirement where I have to attach the table footer to the bottom of the page, to do this, I need to reset a variable (rowCount as per Michael's DevShare example) on every new page to determine how many breaks should I insert in this page.<br />
<br />
Attached is a designer where I have tried to simulate my problem. Please let me know what am I missing here.<br />
<br />
Best Regards<br />
MND
mwilliams
onPageBreak should work. It looks like separate run and render tasks is going to be necessary to get the correct output though, i.e. running in web-viewer and exporting to PDF if running from designer.
Megha Nidhi Dahal
<blockquote class='ipsBlockquote' data-author="'mwilliams'" data-cid="84426" data-time="1319203704" data-date="21 October 2011 - 06:28 AM"><p>
onPageBreak should work. It looks like separate run and render tasks is going to be necessary to get the correct output though, i.e. running in web-viewer and exporting to PDF if running from designer.<br /></p></blockquote>
<br />
Hi Michael,<br />
<br />
Thanks for that, ya it indeed works when I use the way you say.<br />
A quick question; we have used IRunAndRenderTask while instantiating the engine. I haven't run this designto test whether it works fine, but are you saying that we need to do a run and render task seperately?<br />
If yes what would be other implications of it?<br />
<br />
MND
mwilliams
The main difference is the render phase will run completely separately from the other phases. If using the run and render tasks separately, the generation phase runs completely, then the .rptdocument is saved and the presentation phase then uses this document to render the report. So, it'll probably take a little more time to run the report using separate tasks and some script might be affected by the render phase not happening til all the generation is completed, which probably explains the variables not being updated in your above example. This might not change anything though. You can see the script orders here:
http://eclipse.org/birt/phoenix/deploy/reportScripting.php
Vivek Rao Bhosale
<p>Hi, I'm Vivek... I'm a new bee t BIRT. I have created a jsp application for my concern. My problem is to place a table group footer to last page. Describtion is as follows.</p>
<p>1. Created Master header and Footer.</p>
<p>2. Created a table to display data from Database for report generation.</p>
<p>3. The are 16 rows per page.</p>
<p>4. The table group footer must be display along with Master footer only in last page of report if page greater than 1. If not it should be display in same page at top of the master footer.</p>
<p> </p>
<p>Please help me to slove this. Thanks in Advance....</p>