User`s guide

13 Create a Report Program
13-94
Append an HTML Object
You can create an mlreportgen.dom.HTML object and append it to a DOM report. To
append the content of an HTML object more than once in a report, use the clone method
with the HTML object. Then append the cloned copy to the report.
For example, you can create an HTML object from HTML markup to use for a Word report.
import mlreportgen.dom.*;
rpt = Document('MyRep1','docx');
html = HTML('<p><b>Hello</b> <i style="color:green">World</i></p>');
append(html,'<p>This is <u>me</u> speaking</p>');
append(rpt,html);
close(rpt);
rptview(rpt.OutputPath);
Address Errors
If you receive any MATLAB error messages, fix the source HTML markup and append
the HTML again. You can use an HTML cleanup program such as HTML Tidy on a file
containing the source HTML content. HTML Tidy fixes many issues and also identifies
issues you need to address manually. After you clean up the source HTML content,
append it to a DOM report. For details, see “Use an HTML Cleanup Program” on page
13-97.
See Also
mlreportgen.dom.Document.addHTML | mlreportgen.dom.HTML
Related Examples
“Append HTML File Contents to DOM Reports” on page 13-95
“Use an HTML Cleanup Program” on page 13-97
More About
“Appending HTML to DOM Reports” on page 13-91
“HTML Code Requirements for DOM Reports” on page 13-101