Hello! I am developing a birt report which has a table, with groups that spans multiple pages. My group header is repeated when it spans page breaks (which is what I would like for it to do.) I would like to have a mechanism to visually indicate, though, that the group's details have span multiple pages by changing the background of the group header to a new style, or add in the words "Continued" to the header content. I have tried to do this via scripting, however it appears that the onCreate and onRender script hooks are called just once for the header - irrespective of how many times will be repeated? I am rendering a PDF document. Is there a mechanism for me to change the style of the header only when it is repeated?
How are you running the report? Are you using the Viewer or the API? If you are using the API are you using separate run and render tasks? Look at the attached example that shows one way of doing this. I did the example in BIRT 2.6.
Thanks so much for the example and speedy response, Jason! This is an interesting example, and I was trying to do similar scripting stuff. However, I really need to change the header itself, the way I have my layout done, I can not easily add in a detail row to place "continued" into. I augmented your sample slightly to move the "continued" into the header and it does not appear - it looks like the header line only gets evaluated initially and then not again for all repeats of the header. Is there a way to change the repeated header elements - or only add something to the detail rows?
I am programmatically generating the report using a run & render task such as:
// Create the PDF Render Option object here ...
IPDFRenderOption pdfOptions = new PDFRenderOption();
I can send you our report if you would like to take a look, but would prefer to send it directly vs. posting to the forum due to the nature of the report.
Did you not see the onRender event fire?
Add something like this to the onRender event for the group header?
importPackage( Packages.java.io );
out = new PrintWriter( new FileWriter( "c:/temp/pgevents.txt", true ) );
out.println( "group header onRender "+ pageNumber);
I see them now. I think part of what was causing me problems is that in the final render task, there are no page break events that get emitted (page break events are only in the run task). I added in some additional logic to the onRender, however, that would preserve the id of the last rendered header and when the lastID == idToRenderNow then I could change the background styles. I think this should do what I need it to, I am going to work on integrating the sample into my main report today.
Just so I can be more knowledgable going forward - is there a document page somewhere that talks about the events that get emitted during run vs. render when separating the tasks?
Thanks again for all your help - greatly appreciate it!