User`s guide
Appending HTML to DOM Reports
13-91
Appending HTML to DOM Reports
In this section...
“Why Append HTML to a DOM Report?” on page 13-91
“Workflow for Appending HTML” on page 13-91
Why Append HTML to a DOM Report?
You can append HTML markup or the entire contents of an HTML file to a programmatic
report written with the document object model (DOM) API. Append HTML to:
• Convert an existing HTML report to a Microsoft Word or PDF report.
You can append HTML markup for a report to a DOM report, which you can then
generate in Word or PDF format.
• Add content based on HTML markup.
You can append the HTML content to a DOM report. You can use the HTML content
as a building block in a DOM report that includes other report elements.
Workflow for Appending HTML
Appending HTML to a DOM report involves these tasks.
1
In a DOM report, append HTML content or an HTML file to a document or document
part.
For example, this DOM code creates a Word report that displays Hello World,
based on the HTML content that you append to the report.
import mlreportgen.com.*;
d = Document('MyReport','docx');
addHTML(d,'<p style="color:blue"><b>Hello World</b></p>');
An alternative approach is to create an mlreportgen.dom.HTML or
mlreportgen.dom.HTMLFile object and append it to a DOM report.
2
If you receive any MATLAB error messages, fix the source HTML markup and
append the HTML again.