You are here: Blog BI Publisher Working with RTF Sub Templates

Working with RTF Sub Templates

Written by  Sridhar Sunchu
Rate this item
(14 votes)

RTF Sub Template

A sub template is a piece of formatting functionality that can be defined once and used multiple times within a single layout template or across multiple layout template files. This piece of formatting can be an RTF file format or an XSL file format. RTF sub templates are easy to design as you can use Microsoft Word native features. XSL sub templates can be used for complex layout and data

Creating an RTF Sub template File


An RTF sub template consists of one or more <?template?> definitions. Following are the steps to apply RTF sub template in RTF template. Open an RTF file. Use the following syntax to create a template
If more templates are required, they can all be defined in the same way. Sequence of template definition within the sub template file does not matter.

Import Sub template RTF File

To import, save the Sub template in local system or we can use HTTP. Using HTTP sub-template needs to be on a web server and it should be accessible from other machines with HTTP. To use in a local system save the RTF sub template in your local drive. In my case it is saved in c:\sub_template\subtemplate.rtf.
Syntax for importing rtf

Calling a RTF Sub template without parameters from your Main Template


Call RTF Sub Template with parameters




The <?template?> can now be called similar to other template call; however, to handle parameters we will have to enclose the parameters between <?call@inlines?> and <?end call?> tags.
Import statement is not required if sub template is defined in the RTF template file.  In this case, the sub template definition can be shared with other RTF templates.  You cannot conditionalize the import statement for the subtemplate file. Instead, you import one subtemplate file and conditionalize the call statement. You define multiple <?template?> options in the single subtemplate file.

Use of RTF Subtemplates

Multiple reports require the same header and footer content frequently. Hence, by using an RTF subtemplate, any global changes will be simplified and requires only updating the subtemplate instead of each individual layout.


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

Read 16989 times

Leave a comment

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