Package: mlreportgen.dom
Superclasses:
Container of document objects
Creates a container element. Use the mlreportgen.dom.Container.append
method
to append document elements to the container. Use an mlreportgen.dom.Container
object
in a report to apply formats to all of the children of the container.
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 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 and PDF 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 output. Word and PDF output ignore 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.
creates
a container with an HTML tag name containerObj
= Container()div
.
creates
a container with the specified HTML tag name (for example, containerObj
= Container(HTMLtag
)div
, section
,
or article
).