User`s guide

Append HTML File Contents to DOM Reports
13-95
Append HTML File Contents to DOM Reports
In this section...
“Use an addHTMLFile Method” on page 13-95
“Append an HTMLFile Object” on page 13-95
“Address Errors” on page 13-96
You can append HTML files to a DOM document or document part using either of these
approaches:
Use the addHTMLFile method with a Document or DocumentPart object.
Create and append an HTMLFile object.
If the HTML file contents that you append do not meet DOM requirements, the DOM
API generates error messages. You can use an HTML parser and cleanup program such
as HTML Tidy to fix many issues and to identify issues you need to address manually.
Use an addHTMLFile Method
You can use the addHTMLFile method with an mlreportgen.dom.Document or
mlreportgen.dom.DocumentPart object to add the contents of an HTML file to a DOM
report.
For example, you can use addHTMLFile to create an HTMLFile object that you append to
a DOM report that produces Word output.
import mlreportgen.dom.*;
rpt = Document('HTMLToWordReport','docx');
htmlObj = addHTML(rpt,...
'<p><b>Hello</b> <i style="color:green">World</i></p>');
close(rpt);
rptview(rpt.OutputPath);
Append an HTMLFile Object
You can create an mlreportgen.dom.HTMLFile object and append it to a DOM report.