mlreportgen.dom.HTML Class
Namespace: mlreportgen.dom
Superclasses: mlreportgen.dom.Container
Use HTML markup to create DOM document
Description
Use an object of the mlreportgen.dom.HTML class to convert a string of HTML markup to DOM objects and appends them to an
HTML object that it also creates. You can append the HTML object
to a DOM document of any type, including Word and PDF documents.
To see what DOM objects you can append an mlreportgen.dom.HTML object to,
see Append mlreportgen.dom.HTML object to DOM class object.
The mlreportgen.dom.HTML class is a handle class.
Creation
Description
creates an empty
htmlObj = HTMLHTML object.
converts HTML text to an htmlObj = HTML(htmlText)HTML object containing DOM objects
having the same content and format. Unsupported HTML elements and attributes
are ignored. In addition, HTML objects accept HTML that
contains custom CSS properties, which begin with a hyphen. Custom CSS
properties are supported in HTML, Microsoft® Word, and PDF output.
For a complete list of supported HTML elements and CSS formats, see the More About section.
Input Arguments
Properties
Methods
Examples
More About
Tips
For HTML markup to display correctly in your report, you must include end tags for empty elements and enclose attribute values in quotation marks. If you want to show a reserved XML markup character as text, you must use its equivalent named or numeric XML character.
Reserved Character Description Equivalent Character >Greater than ><Less than <&Ampersand &"Double quotation mark "'Single quotation mark '%Percent %MATLAB® Report Generator™
mlreportgen.dom.HTMLormlreportgen.dom.HTMLFileobjects typically cannot accept the raw HTML output of third-party applications, such as Microsoft Word, that export native documents as HTML markup. In these cases, your Report API report generation program can use themlreportgen.utils.html2dom.prepHTMLStringandmlreportgen.utils.html2dom.prepHTMLFilefunctions to prepare the raw HTML for use with themlreportgen.dom.HTMLormlreportgen.dom.HTMLFileobjects. Typically, your program will have to further process the prepared HTML to remove valid but undesirable objects, such as line feeds that were in the raw content.Word and PDF documents require inline elements, such as text and links, to be contained in a paragraph. To meet this requirement, the HTML parser creates wrapper paragraphs to contain inline elements that are not already in a paragraph. If you create an
mlreportgen.dom.HTMLormlreportgen.dom.HTMLFileobject from HTML that contains inline elements that are not in paragraphs and add the object to an HTML document, the generated HTML can differ from the input HTML. To generate the inline elements without the added wrapper paragraphs, insert the HTML markup into an HTML document by using anmlreportgen.dom.RawTextobject.By default, the DOM API uses a base font size of 12 points to convert
emunits to actual font sizes. For example, a font size specified as2emconverts to 24 points. To specify a different base font size, add your content to a report by using anmlreportgen.dom.HTMLobject. Set theEMBaseFontSizeproperty of the object to the base font size. For example, if you set theEMBaseFontSizeproperty to 14, a font size of2emconverts to 28 points.
Version History
Introduced in R2015a
