Template Content and Styles Preview Structure
To preview the content and styles in your templates, you can use the function tmplview
.
tmplview
creates a set of documents based on the content in the main
body of a template, document parts, and stylesheet. By default,
tmplview
displays the generated main body document.
File Output Structure
tmplview
generates files in a directory based on the name and
type of the template in the format
"templateName_templateType_preview"
. For example, a PDF template
with the name "myTemplate"
has the directory name
"myTemplate_PDF_preview"
. tmplview
generates
the following documents in that directory:
templateBody
— Document that contains the content in the main template bodystylesheet
— Document that contains the styles in the stylesheet of the template
The function also generates a subdirectory named
"docpart_templates"
that contains documents demonstrating the
content in each template document part. For example in the HTML template created in
Create and Preview Template, there are three
template documents parts: BookReporter
, ReportTOC
,
and ReportChapter
. In the subdirectory
"docpart_templates"
, tmplview
generates:
"BookReporter.htmx"
— Document that contains the content in the template document part,BookReporter
"ReportTOC.htmx"
— Document that contains the content in the template document part,ReportTOC
"ReportChapter.htmx"
— Document that contains the content n the template document part,ReportChapter
Hole Representation
Holes are placeholders in a template that are filled with content as you generate a report. Each hole in the template body and template document parts is indicated by text in the format,
<HOLE: myTemplateHole, TYPE: block>
where "myTemplateHole"
is the name of the hole. The hole type can
be either "block"
or "inline"
. For more
information on hole types, see Add Holes in Microsoft Word Templates and Add Holes in HTML and PDF Templates. In order to give an accurate preview of how content used to fill the hole will
appear, tmplview
does not add formatting to the text that
represents a hole.
Style Representation
tmplview
divides the generated stylesheet document into these sections:
Text styles
Paragraph styles
Table styles
List styles
If tmplview
cannot identify a CSS style in an HTML
or PDF template as one of these styles, the style appears as raw CSS in a separate
section at the end of the stylesheet document.
Text and Paragraph Styles Sections
The stylesheet document displays text and paragraph styles as the style name
formatted with the style. For example, a text style named
"myTextStyle"
that formats text to be bold and underlined
displays as myTextStyle. The stylesheet document displays any linked
styles in both the text and paragraph styles sections.
For HTML and PDF templates, you can define styles for preformatted elements. The paragraph styles section labels
Preformatted
elements with
"(Preformatted)"
. For example, a style for a preformatted
element called myPreStyle
displays as myPreStyle
(Preformatted)
.
HTML and PDF templates also allow you to define a default style for report
elements. These styles use the label "(Default <type> style)"
.
For example, the following style makes all paragraphs in the document bold,
p {font-weight:bold;}
displays as (Default paragraph style).
Table Styles Section
The table styles section displays each defined style using FormalTable
elements
and the same generic table content. The preview table is large enough to display
formatting specified for any number of these mlreportgen.dom.TemplateTableStyle
properties:
HeaderFormats
, FooterFormats
,
FirstColumnFormats
, LastColumnFormats
,
OddColumnFormats
, EvenColumnFormats
,
OddRowFormats
, EvenRowFormats
,
TopLeftEntryFormats
,
TopRightEntryFormats
,
BottomLeftEntryFormats
, and
BottomRightEntryFormats
.
List Styles Section
For HTML and PDF templates, the stylesheet document displays list styles in this format:
The list style name appends (ordered)
or
(unordered)
based on whether the style is used with OrderedList
or UnorderedList
DOM elements. For
Microsoft® Word templates, the stylesheet document does not make that distinction
because both unordered and ordered list styles can be used to format OrderedList
or UnorderedList
DOM elements.
Other Styles Section
If tmplview
cannot identify a CSS style in an HTML or PDF
template as a text, paragraph, preformatted, table, or list style, the style appears
in the "Other Styles"
section at the end of the stylesheet
document. For example, these two CSS styles format holes.
All the styles in the "Other Styles"
section display as raw
CSS.
See Also
rptview
| mlreportgen.dom.Template
| mlreportgen.dom.TemplateDocumentPart