User`s guide
13 Create a Report Program
13-96
For example, you can convert the contents of two HTML files to a DOM report in Word
format. This example assumes that there are HTML files called myHTMLfile1.html and
myHTMLfile2.htmlin the MATLAB current folder.
import mlreportgen.dom.*;
rpt = Document('MyHTMLReport','docx');
path = 'myHTMLfile1.html';
htmlFile1 = HTMLFile(path);
htmlFile2 = HTMLFile('myHTMLFile2.html');
append(htmlFile1,htmlFile2)
append(rpt,htmlFile1);
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 the
HTML file to fix many issues. HTML Tidy also identifies issues you need to address
manually. After you clean up the 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.addHTMLFile | mlreportgen.dom.HTMLFile
Related Examples
• “Append HTML Content to DOM Reports” on page 13-93
• “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