Home
Analytics
HTML Text and Pagination
anonymoose
<p>Hi Guys!</p>
<p> </p>
<p>I have an rptdesign with an HTML text component which I'm rendering to PDF.</p>
<p> </p>
<p>I'm seeing some funny pagination behavior that I wanted to share.</p>
<p> </p>
<p>When I IRunAndRender directly to PDF, the page numbers seem to calculate correctly.</p>
<p> </p>
<p>However, when I IRun, then separately IRender, the HTML section always repeats page numbers.</p>
<p> </p>
<p>In other words, if the report is 20 pages long with the last five pages being the HTML section, pages 15 - 20 will all be numbered "15".</p>
<p> </p>
<p>Interestingly, if I change the text box to non-html, the pagination behavior changes, and behaved as expected.</p>
<p> </p>
<p>Is there something special about HTML text / emmitter and what's the recommended approach here?</p>
<p> </p>
<p>Any experience, advice and feedback is greatly appreciated!</p>
<p> </p>
<p>TIA</p>
Find more posts tagged with
Comments
JFreeman
<p>Is the HTML text one section with multiple pages worth of text?</p>
<p>What are you using to display the page numbers?</p>
<p> </p>
<p>I believe this happens due to when the run occurs that html section is generated as one long piece with no page breaks and thus would be displayed to HTML as a single page. I believe the page numbers are generated during run so that long HTML text piece gets page number 15. Then, when the render task occurs to PDF, page breaks are force into the HTML text but the page numbers are not regenerated thus displaying the same page number for reach page of the HTML text section.</p>
anonymoose
<p>Thanks for your reply.</p>
<p> </p>
<p>I share your belief -</p>
<p>When running and rendering as two distinct tasks, regardless of its length, the HTML in the web viewer (browser) shows all on one page with a vertical scroll bar and a page number at the bottom (15 if we continue the example). Then when exported to PDF, that HTML breaks into several pages, but the page numbers DO NOT get recalculated. To me, this seems like a bug. I'd prefer for the HTML to page break right in the web browser, after the run task (just as regular text does).</p>
<p> </p>
<p>My HTML is one long block inside one text box.</p>
<p> </p>
<p>For page number, I'm using the autotext "Page Number" found in the Palette tab of the master page. I also tried using <viewtime-value-of>pageNumber but unfortunately it behaves exactly the same way.</p>
anonymoose
<p>Can anyone confirm whether this is expected behaviour or a bug?</p>
<p> </p>
<p>Either way, what's the recommendation for page numbers on a multi-page html content generated via seprate run and render tasks?</p>
<p> </p>
<p>TIA</p>
JFreeman
<p>As far as I know, I believe this is expected based on how the current run/render tasks work with PDF output, HTML text elements and the auto text variables.</p>
<p>I would recommend filing a bug report requesting an enhancement to the behavior.</p>
<p> </p>
<p>In the meantime, you can instead look at using scripting to calculate and set the page numbers manually versus using the auto text value.</p>
anonymoose
<div>
<p> </p>
<blockquote class="ipsBlockquote" data-author="JFreeman" data-cid="139102" data-time="1442417971">
<div>
<p>In the meantime, you can instead look at using scripting to calculate and set the page numbers manually versus using the auto text value.</p>
</div>
</blockquote>
<p> </p>
</div>
<div> </div>
<div>JFreeman,</div>
<div> </div>
<div>I tried using the my own counter approach and not relying on the autoText variable, but the behavior is exactly the same - my counter value turns out to be exactly the same as the autoText var.</div>
<div> </div>
<div>To recap my approach:</div>
<div> </div>
<div>- initialize the counter, and a HashMap to hold names of sections an page numbers on the root rptdesign level</div>
<div>- counter++ <strong>onPageBreak</strong></div>
<div>- put new entry into HashMap <strong>onCreate </strong>of each section -- ie put("someText", currentCounterVal)</div>
<div>- set the Map as a persistantGlobalVariable on the reportContext</div>
<div>- during render phase render contents of map onto a text box (for table of contents)</div>
<div> </div>
<div>Please let me know if my understanding is correct :</div>
<div>Since page numbers are calculated during the RUN phase of the gen, and this phase has already been executed by the time the web browser has rendered the contents, I think the onRender events/script do not fire again during the render-to-pdf phase.</div>
<div> </div>
<div>Interestingly, when I change the report layout from "Fixed" to "Auto" the HTML paginages as expected in the web viewer.</div>
anonymoose
<p>Posting links to other threads on this, for posterity:<br><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/forum/index.php?/topic/24255-page-breaks-with-dynamic-text-leaves-page-empty/'>http://developer.actuate.com/community/forum/index.php?/topic/24255-page-breaks-with-dynamic-text-leaves-page-empty/</a></p>
;
<p> </p>
<p> </p>
<p>Viewtime value of:</p>
<p><a data-ipb='nomediaparse' href='
https://eclipse.org/birt/phoenix/project/notable3.7.php'>https://eclipse.org/birt/phoenix/project/notable3.7.php</a></p>
;
<p><em><span style="color:rgb(0,0,0);font-family:Arial, sans-serif;font-size:12px;">The Viewtime-Value-Of Text Report Item function was introduced in </span><a data-ipb='nomediaparse' href='
http://www.eclipse.org/birt/phoenix/project/notable2.6.php#jump_12'>BIRT
2.6</a><span style="color:rgb(0,0,0);font-family:Arial, sans-serif;font-size:12px;"> and allows a value of a variable to be evaluated at render time as opposed to runtime.</span></em></p>
<p> </p>
<p> </p>
<p>Also went through the source code a bit and found this option:</p>
<p>HTMLRenderOption contains a setter - setHTMLPagination (default to false):</p>
<p><a data-ipb='nomediaparse' href='
http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.birt.runtime/org.eclipse.birt.runtime/4.4.1/org/eclipse/birt/report/engine/api/IRenderOption.java#IRenderOption.0HTML_PAGINATION'>http://grepcode.com/file/repo1.maven.org/maven2/org.eclipse.birt.runtime/org.eclipse.birt.runtime/4.4.1/org/eclipse/birt/report/engine/api/IRenderOption.java#IRenderOption.0HTML_PAGINATION</a></p>
;
<p> </p>
<p>This seems to be exactly what I need to set, but when I tried it, doesn't work.</p>
anonymoose
<p>Tried another failed approach this morning:</p>
<p> </p>
<p>Changed from Run then Render to RunAndRender and tried putting table of contents element as the last page. I was planning to run post process commands on the generated PDF to move the last page to the second position.</p>
<p> </p>
<p>In base case testing (simple, non-nested report structure), using RunAndRender, this approach works and the table of contents displays correctly as the last page.</p>
<p> </p>
<p>However, when extending this approach to my actual report, which uses chart, table and html text library "components" (which are grid element containers with said elements inside), I get the following error if I add a counter incrementor to the rptdesign's onPageEnd event (or any text for that matter):</p>
<pre class="_prettyXprint">
Caused by: java.lang.ClassCastException: org.eclipse.birt.report.engine.content.impl.RowContent cannot be cast to java.lang.Comparable</pre>
<p>If I move the counter element out of the rptdesign level event and onto each component's onPageBreak event, I see that onPageBreak doesn't get called for every page break, but much less often.</p>
<p> </p>
<p>I'm running BIRT v 4.4.2.</p>
<p> </p>
<p>
</p>
JFreeman
<p>Sorry for the delay.</p>
<p> </p>
<p>Do you think you could reproduce a sample report based on classic models or a flat file data source with the setup you have that worked on a simple report but threw that error on your actual report?</p>
<p> </p>
<p>It sounds like that approach is the best option so far and if we can get past that error you may be in business.</p>
anonymoose
<p>Yes, will post that up soon.</p>
<p> </p>
<p>In the meantime finishing up a workaround approach which uses Auto layout with separate run and render tasks, puts TOC as the last page and requires a post process step to move the last page (TOC) to the second page of the report (if not through birt natively, then via some 3rd party lib).</p>
<p> </p>
<p>Once I finish, I'll post that up as well.</p>
<p> </p>
<p>Many lessons learned in the last few days...</p>
anonymoose
<p>Attached file shows the initially-reported issue. HTML content page number (autoText) repeats.</p>
<p> </p>
<p>If you flip the layout from "Fixed" to "Auto", page numbering will work correctly.</p>
anonymoose
<p>JFreeman,</p>
<p> </p>
<p>As requested, this attached rptdesign shows the issue with incrementing the counter onPageEnd of the rptdesign level. If you have ANY content (even commented content) in the onPageEnd handler of the rptdesign level, it throws the below exception. Flipping the layout flag to "Auto" also fixes this issue.</p>
<pre class="_prettyXprint _lang-">
org.eclipse.birt.report.engine.api.EngineException: Error happened while running the report.
at org.eclipse.birt.report.engine.api.impl.EngineTask.handleFatalExceptions(EngineTask.java:2363)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:277)
at org.eclipse.birt.report.engine.api.impl.RunTask.run(RunTask.java:86)
at org.eclipse.birt.report.service.ReportEngineService.runReport(ReportEngineService.java:1325)
at org.eclipse.birt.report.service.BirtViewerReportService.runReport(BirtViewerReportService.java:158)
at org.eclipse.birt.report.service.actionhandler.BirtRunReportActionHandler.__execute(BirtRunReportActionHandler.java:81)
at org.eclipse.birt.report.service.actionhandler.BirtGetPageActionHandler.__checkDocumentExists(BirtGetPageActionHandler.java:58)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.prepareParameters(AbstractGetPageActionHandler.java:118)
at org.eclipse.birt.report.service.actionhandler.AbstractGetPageActionHandler.__execute(AbstractGetPageActionHandler.java:103)
at org.eclipse.birt.report.service.actionhandler.AbstractBaseActionHandler.execute(AbstractBaseActionHandler.java:90)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseDocumentProcessor.__executeAction(AbstractBaseDocumentProcessor.java:47)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.executeAction(AbstractBaseComponentProcessor.java:143)
at org.eclipse.birt.report.soapengine.processor.BirtDocumentProcessor.handleGetPage(BirtDocumentProcessor.java:87)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.eclipse.birt.report.soapengine.processor.AbstractBaseComponentProcessor.process(AbstractBaseComponentProcessor.java:112)
at org.eclipse.birt.report.soapengine.endpoint.BirtSoapBindingImpl.getUpdatedObjects(BirtSoapBindingImpl.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:397)
at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:186)
at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)
at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.doPost(BirtSoapMessageDispatcherServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.birt.report.servlet.BirtSoapMessageDispatcherServlet.service(BirtSoapMessageDispatcherServlet.java:122)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:360)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:684)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:503)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:229)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:429)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
at org.eclipse.jetty.server.Server.handle(Server.java:366)
at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:982)
at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1043)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.ClassCastException: org.eclipse.birt.report.engine.content.impl.ContainerContent cannot be cast to java.lang.Comparable
at java.util.TreeMap.put(TreeMap.java:542)
at java.util.TreeSet.add(TreeSet.java:238)
at java.util.AbstractCollection.addAll(AbstractCollection.java:305)
at java.util.TreeSet.addAll(TreeSet.java:295)
at java.util.TreeSet.(TreeSet.java:143)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle.doAddContent(OnPageBreakLayoutPageHandle.java:143)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle.addContent(OnPageBreakLayoutPageHandle.java:135)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle.access$0(OnPageBreakLayoutPageHandle.java:115)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:168)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageBreakContentCollector.visitContainer(OnPageBreakLayoutPageHandle.java:174)
at org.eclipse.birt.report.engine.nLayout.area.impl.ContainerArea.accept(ContainerArea.java:276)
at org.eclipse.birt.report.engine.executor.OnPageBreakLayoutPageHandle$PageContentBuilder.startPage(OnPageBreakLayoutPageHandle.java:189)
at org.eclipse.birt.report.engine.emitter.CompositeContentEmitter.startPage(CompositeContentEmitter.java:290)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.outputPage(LayoutEngine.java:963)
at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.outputPage(PageArea.java:707)
at org.eclipse.birt.report.engine.nLayout.area.impl.PageArea.close(PageArea.java:687)
at org.eclipse.birt.report.engine.nLayout.area.impl.RootArea.autoPageBreak(RootArea.java:68)
at org.eclipse.birt.report.engine.nLayout.area.impl.BlockTextArea.update(BlockTextArea.java:239)
at org.eclipse.birt.report.engine.nLayout.area.impl.BlockContainerArea.close(BlockContainerArea.java:126)
at org.eclipse.birt.report.engine.nLayout.area.impl.BlockTextArea.close(BlockTextArea.java:109)
at org.eclipse.birt.report.engine.nLayout.area.impl.BlockTextArea.layout(BlockTextArea.java:80)
at org.eclipse.birt.report.engine.nLayout.LayoutEngine.startContent(LayoutEngine.java:564)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startText(ContentEmitterAdapter.java:147)
at org.eclipse.birt.report.engine.emitter.ContentEmitterAdapter.startLabel(ContentEmitterAdapter.java:153)
at org.eclipse.birt.report.engine.emitter.ContentEmitterUtil.startContent(ContentEmitterUtil.java:65)
at org.eclipse.birt.report.engine.layout.html.buffer.HTMLPageBuffer.startContent(HTMLPageBuffer.java:116)
at org.eclipse.birt.report.engine.layout.html.buffer.TableBreakBuffer.startContent(TableBreakBuffer.java:287)
at org.eclipse.birt.report.engine.layout.html.HTMLLeafItemLM.start(HTMLLeafItemLM.java:67)
at org.eclipse.birt.report.engine.layout.html.HTMLAbstractLM.layout(HTMLAbstractLM.java:139)
at org.eclipse.birt.report.engine.layout.html.HTMLBlockStackingLM.layoutNodes(HTMLBlockStackingLM.java:70)
at org.eclipse.birt.report.engine.layout.html.HTMLPageLM.layout(HTMLPageLM.java:92)
at org.eclipse.birt.report.engine.layout.html.HTMLReportLayoutEngine.layout(HTMLReportLayoutEngine.java:100)
at org.eclipse.birt.report.engine.presentation.ReportDocumentBuilder.build(ReportDocumentBuilder.java:249)
at org.eclipse.birt.report.engine.api.impl.RunTask.doRun(RunTask.java:269)
... 62 more
</pre>
anonymoose
<p>The below write-up is with regards to PDF report which contains HTML content (in addition to non-html content):</p>
<p> </p>
<p><u><strong>Summary:</strong></u></p>
<ul><li><strong>Fixed </strong>report layout with HTML content is not possible, even if attempting to count pages with custom counter.</li>
</ul><p style="margin-left:80px;">a. IRunAndRender causes repeating page numbers on HTML content. Keeping own counter not an option since page-level events aren't guaranteed with IRunAndRender.</p>
<p style="margin-left:80px;">b. Separate IRun and IRender causes unwanted page breaks before and after the HTML content.</p>
<ul><li><strong>Auto </strong>report layout with HTML content is possible using either IRunAndRender or separate IRun, IRender tasks.</li>
</ul><p style="margin-left:80px;">a. IRunAndRender numbers pages correctly with autoText (but not with own counter), but table of contents doesn't display since IRunAndRender doesn't fire render events correctly and TOC content is written via script to a textbox onRender.</p>
<p style="margin-left:80px;">b. Sperate IRun and IRender tasks do give the correct page numbers and a correct table of contents but TOC must be the last element on the page. This is because TOC registration happens during onRender a component. By the time TOC starts to render, the map used for registration must have already been populated.</p>
<p> </p>
<p><strong><u>Major Takeaway:</u></strong></p>
<ul><li>Any TOC "registrations" (ie put to map) can only happen during the Render phase, onRender, or else only design-time page breaks will be considered (these are a subset of all the page breaks; ie. new master page, pageBreakAfter = true). The IRun phase is non-paginated. This went against many of the tutorials which specifically instructed to 'register' TOC entries during the IRun phase. The tutorials didn't consider HTML content, I suppose.</li>
</ul><p> </p>
<p><strong><u>Cliff notes/Solution:</u></strong></p>
<ul><li>if HTML content is present on your report, you must use Auto layout.</li>
<li>if TOC is also required, you must use separate IRun and IRender tasks and do all pageNumber 'registration' during the render phase. TOC should be the last element in the report and should get moved to the second page during post processing phase (I used a third party lib for this, after unsuccessfully trying in BIRT).</li>
</ul><p>Even though it's the only solution, I'm still not sure Auto layout is acceptable to use here. I'm concerned that if/when I try to size my components, the given size will not be honored by the engine because auto layout caues auto sizing.</p>
<p> </p>
<p> </p>
<p>If anyone knows the answer to my remaining questions regarding component sizing during auto layout or about moving a given page after report creation, please let me know.</p>
<p> </p>
<p>Either way, I hope this thread helps the next guy.</p>
SchmidS
<p>Hi TIA.<br><br>
I experienced exactly the same behavior, thanks for your post - nice to see I'm not the only one
</p>
<p> </p>
<p>This issue is really frustrating, because moving the TOC isn't an option for me. I'm integrating BIRT runtime into another software and the users should be enabled to edit or swap report designs - so I can't be sure about TOC presence. Also it would be a hard time explaining why the TOC is located at the end but after report generation shows up at another position.</p>
<p> </p>
<p>If anyone comes up with a solution I would really appreciate it if he shares it.</p>
anonymoose
<p>SchmidS,</p>
<p> </p>
<p>Since posting the above, I have thought of a cleaner solution which costs a little more performance-wise but would not require a move and would honor multi-page TOC, and page numbers (which is one of the limitations of moving from the last page - there's an assumption that TOC can never be multi-page)</p>
<p> </p>
<p>Run the report TWICE. First run records the TOC mapping. Second run writes it to the report.</p>
<p> </p>
<p>Here's the breakdown:</p>
<p>
</p>
<p>- Keep your TOC in the second page or wherever you need it.</p>
<p>- Script logic for datasource look for existance of a persistant TOC data which you would have recorded already on a previous run (probably need to create a datasource linked to a file or db)</p>
<p>- During the first pass render phase, do all your registration and write the results to some persitatnt layer (DB, File, whatever).</p>
<p>- During the second pass, the existence of the persistant TOC data would trigger the script and write it to to the datasource, and in turn can be populated directly into the TOC component wherever it may live. By the time TOC renders it's datasource is populated with whatever TOC data is available, and its no different than any traditional table/chart.</p>
<p> </p>
<p>Hope this helps. </p>