mlreportgen.dom.HTMLFile Class
Namespace: mlreportgen.dom
Superclasses: mlreportgen.dom.HTML
Convert an HTML file to a DOM document
Description
Converts 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.
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.
An HTMLFile object supports these HTML elements and
attributes. 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.
| HTML Element | Attributes |
|---|---|
a | class, style,
href, name |
address | class, style |
b | class, style |
big | class, style |
blockquote | class, style |
body | class, style |
br | n/a |
center | class, style |
cite | class, style |
code | class, style |
dd | class, style |
del | class, style |
dfn | class, style |
div | class, style |
dl | class, style |
dt | class, style |
em | class, style |
font | class, style,
color, face,
size |
h1, h2, h3, h4, h5, h6 | class, style,
align |
hr | class, style,
align |
i | class, style |
ins | class, style |
img | class, style,
src, height,
width |
kbd | class, style |
li | class, style |
mark | class, style |
nobr | class, style |
ol | class, style |
p | class, style,
align |
pre | class, style |
s | class, style |
samp | class, style |
small | class, style |
span | class, style |
strike | class, style |
strong | class, style |
sub | class, style |
sup | class, style |
table | class, style,
align, bgcolor,
border, cellspacing,
cellpadding, frame,
rules, width |
tbody | class, style,
align, valign |
tfoot | class, style,
align, valign |
thead | class, style,
align, valign |
td | class, style,
bgcolor, height,
width, colspan,
rowspan,align,
valign, nowrap |
th | class, style,
bgcolor, height,
width, colspan,
rowspan,align,
valign, nowrap |
tr | class, style,
align,bgcolor,
valign |
tt | class, style |
u | class, style |
ul | class, style |
var | class, style |
For information about these elements, see https://developer.mozilla.org/en-US/docs/Web/HTML/Element.
These CSS formats are supported:
background-colorborderborder-bottomborder-bottom-colorborder-bottom-styleboder-bottom-widthborder-colorborder-leftborder-left-colorborder-left-styleboder-left-widthborder-rightborder-right-colorborder-rigtht-styleborder-right-widthborder-styleborder-topborder-top-colorborder-top-styleborder-top-widthborder-widthcolorcounter-incrementcounter-resetdisplayfont-familyfont-sizefont-stylefont-weightheightline-heightlist-style-typemarginmargin-bottommargin-leftmargin-rightmargin-toppaddingpadding-bottompadding-leftpadding-rightpadding-toptext-aligntext-decorationtext-indentvertical-alignwhite-spacewidth
For information about these formats, https://developer.mozilla.org/en-US/docs/Web/CSS/Reference.
Input Arguments
Properties
Methods
Examples
Tips
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
