User`s guide
13 Create a Report Program
13-42
p = Paragraph(CharEntity('pound'));
append(d,p);
append(p,'3');
close(d);
rptview('test','html');
Append HTML or XML Markup
To append HTML markup to an HTML document or Microsoft Word XML markup to a
Word document, use an mlreportgen.dom.RawText object. This is useful for creating
HTML or Word elements that the DOM API does not support directly, such as the HTML
div element. This example shows how to create a RawText object to append HTML
markup.
import mlreportgen.dom.*;
d = Document('test','html');
append(d,RawText('<div id = toc> </toc>'));
close(d);
rptview('test','html');
Format Text
You can format text programmatically, using either DOM format objects or Text object
format properties. You can also use Word and HTML template styles. For information
about these formatting techniques and format inheritance, see “Report Formatting
Approaches” on page 13-20.
Format Text Programmatically
You can use format objects to format Text objects or format properties to specify
commonly used text formats. This example uses:
• A FontFamily format object to specify the primary and backup font
• The Bold format property to specify text weight
import mlreportgen.dom.*;
d = Document('test','html');
t = append(d, 'Bold Arial text');