Adding "Continued.." to the bottom of a table if the content spills over more than one page is a very common requirement for Customer Bills. I am sure most of you have already seen Tim's blog on this topic. Just wanted to add a small note here which I got as a quick tidbit from our template expert, Hok Min. This requirement came from a telecom customer:
- The invoice had multiple tables giving different bill breakups such as "Current Charges", "Usage Charges", "Discounts", "Itemized bills for Local Calls", "Itemized bills for STD Calls" etc. Among these, any of the table could spill over to next page in any of the pages.
- The itemized bills were grouped under a category "Your Itemized Bill"
The requirement was
- Whenever a table splits across page, the next page should repeat the table header and should also display "(Continued ..)" in the table header
- If the table is inside the category - "Your Itemized Bill", then the heading "Your Itemized Bill" should repeat in the next page added with "(Continued ..)" text
- With multiple tables within the category "Your Itemized Bill", the "(Continued ...)" message should be displayed for all tables if they split across page.
This can be seen here in the images:
Page 1: Here "YOUR ITEMIZED BILL" and "Local Calls" starts in this page.
Page 2: Here "YOUR ITEMIZED BILL" and "Local Calls" are in continuation from previous page while "STD Calls" table starts in this page.
Page 3: Here "YOUR ITEMIZED BILL" and "STD Calls" are in continuation from previous page.
We can use the same code logic that was explained in Tim's blog. The main thing to note here is that the init-page-total should be included within each table. If the init statement of a table is kept outside then it will not be able to reset the context to display "Continued ..." correctly. Here the first two rows of the external table and the nested table are marked to "Repeat as header row at the top of each page". The itemized bills are displayed grouped by date, therefore for-each-group is done in the third row of the nested table and the last row has the for-each loop to display each transaction.
The below image shows the code corresponding to the above table design. Notice the use of display-condition="exceptfirst" so that "(Continued..)" text will show in all table-headers except the first one.
You can find the sample RTF template and XML data here.
Stay tuned for more updates...
Enjoy :) !!