User`s guide
13 Create a Report Program
13-46
Create and Format Paragraphs
In this section...
“Create a Paragraph” on page 13-46
“Create a Heading” on page 13-46
“Format a Paragraph” on page 13-47
Create a Paragraph
You can create a paragraph by using an mlreportgen.dom.Paragraph constructor
with a text string. For example:
p = Paragraph('Text for a paragraph');
You can also specify these DOM objects in a Paragraph object constructor.
• mlreportgen.dom.Text
• mlreportgen.dom.ExternalLink
• mlreportgen.dom.InternalLink
• mlreportgen.dom.LinkTarget
• mlreportgen.dom.Image
Create a Heading
You can use an mlreportgen.dom.Heading object to create a paragraph that you want
to appear in the table of contents of a document (see “Create a Table of Contents” on
page 13-78). Specify the heading level as the first argument in the Heading object
constructor, followed by the heading content. Optionally, as a third argument, you can
specify the name of a paragraph style defined in the template used to generate your
report.
This example creates a heading with the text Chapter 1: System Overview and
specifies the heading to appear at the top level in a table of contents.
h1 = Heading(1,'Chapter 1: System Overview');