User`s guide
13 Create a Report Program
13-26
Create Object Containers
You can use an mlreportgen.dom.Container object to create an HTML container
object, such as a div, section, or article, not otherwise supported by the DOM API
and to simulate HTML format inheritance in Word output.
In HTML output, a Container object generates an HTML element of the type specified
by its HTMLTag property and containing HTML elements corresponding to its DOM
contents. For example, a Container object with the HTMLTag property div and that
contains the text Hello World generates this markup:
<div><p><span>Hello World</span></p></div>
The generated HTML container element has the class and style properties specified
by the Container object StyleName and Style properties, respectively. The rules
of HTML CSS (cascading style sheets) format inheritance assure that the generated
children of the Container object inherit the formats specified by the Container object
Style and StyleName properties. For example, if the Container object specifies red as
its text color and none of its text children specify a color, the text children are colored red.
For Microsoft Word report output, a Container object simulates container format
inheritance, applying the formats specified by the Container object Style attribute
to each child, unless overridden by the child, and then appending the child to the
Word output. The Word output ignores the HTMLTag and StyleName properties of the
Container object.
Tip You can use mlreportgen.dom.Container or mlreportgen.dom.Group objects to
produce collections of document elements.
• Use a container object to apply format inheritance to a set of objects and to create
HTML container elements not otherwise supported by the DOM, such as div, section,
and article.
• Use a group object to append the same content in multiple places in a document
without cloning the group.
See Also
Classes
mlreportgen.dom.Container | mlreportgen.dom.Group