User`s guide
13 Create a Report Program
13-84
object alone or in combination with template-based styles or format object-based styles.
This example assumes that the template MyTemplate includes a TOC reference.
import mlreportgen.dom.*;
d = Document('MyReport','docx','MyTemplate');
h1 = {FontFamily('Arial'),FontSize('16pt')};
h2 = {FontFamily('Arial'),FontSize('14pt')};
h = append(d, Heading(1,'Chapter 1'));
h.style = h1;
h = append(d, Heading(2,'Section 1'));
p.style = h2;
close(d);
rptview(d.OutputPath); % Updates the TOC
The Heading objects generate HTML h1, h2 (and so on) elements. By using Heading
objects in an HTML report, you can ensure that your report uses the default styles for
headings implemented by the browser in which you display the report.
See Also
Functions
rptview | unzipTemplate | zipTemplate
Classes
mlreportgen.dom.Heading
Related Examples
• “Create a Microsoft Word Template” on page 13-111
• “Create an HTML Template” on page 13-122