mlreportgen.dom.HTMLFile Class
Namespace: mlreportgen.dom
Superclasses: mlreportgen.dom.HTML
Convert an HTML file to a DOM document
Description
Use an object of the mlreportgen.dom.HTMLFile class to convert the contents of an HTML file to an
mlreportgen.dom.HTMLFile object containing DOM objects having the
same content and format. You can append the HTMLFile object to a DOM
document of any type, including Word and PDF documents.
To see what DOM objects you can append an mlreportgen.dom.HTMLFile object to,
see Append mlreportgen.dom.HTMLFile object to DOM class object.
The mlreportgen.dom.HTMLFile class is a handle class.
Creation
Description
converts the HTML file to an htmlFileObj = HTMLFile(htmlFile)HTMLFile object containing
DOM objects having the same content and format. Unsupported HTML elements
and attributes are ignored. In addition, HTMLFile 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 Supported HTML elements and CSS formats.
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 %HTMLFileignores theKeepInterElementWhiteSpaceproperty. If you want to preserve white space, usefilereadto read your HTML file as text and then follow the procedure described for themlreportgen.dom.HTMLKeepInterElementWhiteSpaceproperty.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
