Class: mlreportgen.dom.Document
Package: mlreportgen.dom

Append HTML string to document


htmlObjOut = addHTML(documentObj,htmlText)


htmlObjOut = addHTML(documentObj,htmlText) converts a string of HTML text to a group of DOM objects and appends the group to the Document object documentObj.

Input Arguments

expand all

Document object to append content to, specified as an mlreportgen.dom.Document object.

HTML text, specified as a character vector.

Example: '<p><b>Hello</b> <i style="color:green">World</i></p>'

Output Arguments

expand all

HTML object with appended content, returned as an mlreportgen.dom.HTML object.


expand all

Create an HTML object from HTML text to use for a Microsoft® Word report.

import mlreportgen.dom.*;
rpt = Document('HTMLToWordReport','docx');     
htmlObj = addHTML(rpt,...
    '<p><b>Hello</b> <i style="color:green">World</i></p>');

Generate the Word report.



By default, the DOM API uses a base font size of 12 points to convert em units to actual font sizes. For example, a font size specified as 2em converts to 24 points. To specify a different base font size, add your content to a report by using an mlreportgen.dom.HTML object. Set the EMBaseFontSize property of the object to the base font size. For example, if you set the EMBaseFontSize property to 14, a font size of 2em converts to 28 points.

Introduced in R2015a