You are here: BI Publisher Generating Table of Contents in BI Publisher RTF Template

Generating Table of Contents in BI Publisher RTF Template

Written by  Sridhar Sunchu
Rate this item
(6 votes)

In this blog I am going to explain how to generate Table of Contents with links to their respective page in RTF template dynamically.

BI Publisher provides the ability to create dynamic section headings in your document from the XML data. You can then incorporate these into a Table of Contents.


To create dynamic headings:

Let us create sample XML data assuming we have different areas and within areas we have different plants.

<?xml version="1.0" encoding="UTF-8"?>

<dataroot>

<TOC>

<G_AREA>

<Area>Area1</Area>

<G_PLANT>

<Plant>Plant1</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant2</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant3</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant4</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant5</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant6</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant7</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant8</Plant>

</G_PLANT>

</G_AREA>

<G_AREA>

<Area>Area2</Area>

<G_PLANT>

<Plant>Plant1</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant2</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant3</Plant>

</G_PLANT>

<G_PLANT>

<Plant>Plant4</Plant>

</G_PLANT>

</G_AREA>

</TOC>

</dataroot>

 Step1:

Create a RTF template and for the heading in the body of the document, and format it as a "Heading", using your word processing application's style feature. You cannot use form fields for this functionality.

For example, you want your report to display a heading for each company reported. The XML data element tag name is <COMPANY_NAME>. In your template, enter <?COMPANY_NAME?> where you want the heading to appear. Now format the text as a Heading.

Now we need to update the styles for <?Area?>  with Heading1 and for <?Plant?>  with Heading2.

Step2:

Once styles are mentioned, create a table of contents using your word processing application's table of contents feature. Select the page where table of contents to be displayed and goto References tab then select table of contents(Automatic)

After Table of Contents is selected you can see the below content.

At runtime the TOC placeholders and heading text will be substituted.

Output:

"If you found this article useful, please rate the same"

If you need any assistance in BI Publisher implementation or RTF Template design, we can help you out. please send your query to  This e-mail address is being protected from spambots. You need JavaScript enabled to view it

Read 10458 times

Leave a comment

Make sure you enter the (*) required information where indicated.
Basic HTML code is allowed.