Wednesday, March 6, 2013

RTF Subtemplates

Sub templates are used whenever you like to show some section/body in the report conditionally and also we can reuse the content in several places like header and footer in many pages.

Below are the steps to work with Sub templates.

1.Create a Subtemplate

2.Upload the Subtemplate into BI Publisher server

3.Call the Subtemplate from the Maintemplate

4.Call the desired section from  Subtemplate  into Main template

Creating  a Subtemplate

create a rtf template with the Template syntax.

Template syntax

<?template:%templatename%?>

for example

<?template:Header?>

Place the Header content here..

<?end template?>







save the template with a name (letsay subtemp)

Upload the Subtemplate into BI Publisher server

Log in to BI Publisher

Navigate New>Subtemplate

select the subtemp.rtf file and save as Header_Template (it will append .xsb as the file type).

Call the Subtemplate from the Maintemplate

After you upload the subtemplate into server, it can be referenced from another Main rtf template using the following syntax.

<?import:xdoxsl:%subtemplate_path%?>

for example ,to load the header defined in Header_Template.xsb place the below syntax any where in the Main rtf template



<?import:xdoxsl:///Sample/Header_Template.xsb?>

Assume subtemplate saved in Shared Folders/Sample directory.

Call the desired section from  Subtemplate  into Main template

to display the Header section in the Main report, Call the Header template from the Main rtf template from the place where you want to display(usually it should in Header region),Use the below syntax to call a template

<?call-template:%template_name%?>

for example : Place the below syntax in the Main rtf template Header region.



<?call-template:Header?>

Thats it,Now we have common Header and we can reference it from any report.

No comments:

Post a Comment