Main Content

Create HTML Document Part Template Library

In the default template package, the file docpart_templates.html defines the library and some default document part templates. In your document part template library, create the document parts that you want to reuse throughout your report. You can create a part template for any part of your document that you want to repeat without redefining it programmatically.

A document part template typically consists of fixed content and holes. You can use standard HTML elements to define your templates. You can also use the <toc> element for a table of contents. For details, see Create Tables of Contents.

Use this workflow to work on your document part template library:

  1. Unzip the template package containing the part template library file.

  2. Open the document part templates file, named docpart_templates.html by default, in an HTML or text editor.

  3. Edit the file as needed using the elements described in HTML Document Part Template Library Structure.

  4. Add any styles that support the document part templates in a .css file in the template package. See Modify Styles in HTML Templates.

  5. Save the library files you edited.

  6. Repackage the template using ziptemplate.

HTML Document Part Template Library Structure

You create your document part library using the <dplibrary> element. Add a <dplibrary> element inside a <body> element. Your template package can have only one <dplibrary> element.

Use <dptemplate> elements inside a <dplibrary> element for each document part template that you want to create. You can create as many document part templates as you need.

This code shows the basic structure of a document part library. The <dptemplate> element has the attribute name, which you set to the name to use when you call the document part from your report program. The name is equivalent to the name of the part in the Quick Parts Gallery in Word. If you are creating templates for multiple outputs, use the same name in both places.


        <dptemplate name="myFirstDocPartTemp">
            [Document part template content--holes and fixed content]


See Also


Related Topics