User`s guide

Create a Document Object to Hold Content
13-9
Create a Document Object to Hold Content
Every report program must create an mlreportgen.dom.Document object to hold
report content. Use the mlreportgen.dom.Document constructor to create a Document
object.
If you use the constructor with no arguments, the DOM API creates an HTML document
named Untitled.htmx in the current folder.
You can specify the file system path of the report as the first argument of the constructor.
You can specify the type of report to be generated by using a second argument. You can
specify the type to be 'html' or 'docx' (for Microsoft Word). You can then use the
rptview function to convert a Word report to PDF, or you can open the report in Word
and save it as PDF.
This Document constructor creates an HTML report called myReport.
d = Document('myreport','html');
Using a third argument, you can specify the file system path of a Word or HTML
template to be used as a basis for creating the report. You need to specify a template
only if you are using template-based formatting (using style sheets) or form-based report
generation. If you specify a template, it must be a Word template (.dotx) for Word
reports or an HTML template (.htmtx) for HTML reports. For example, this Document
constructor creates a Word report using the Word template myWordTemplate.dotx.
d = Document('myreport','docx','myWordTemplate');
See Also
Functions
rptview
Classes
mlreportgen.dom.Document
Related Examples
“Create a Report Program” on page 13-3
“Use Style Sheets” on page 13-21