mlreportgen.utils.html2dom.prepHTMLString
Syntax
Description
prepares the HTML in the string specified by preppedHTMLStr
= mlreportgen.utils.html2dom.prepHTMLString(htmlStr
)htmlStr
for conversion to
the MATLAB®
Report Generator™ internal document object model (DOM). The prepared HTML in
preppedHTMLStr
can be converted to a DOM API representation by using an
mlreportgen.dom.HTML
object. The
mlreportgen.utils.html2dom.prepHTMLString
function:
Corrects invalid markup by calling
mlreportgen.utils.tidy
with the settings for HTML output.Uses the MATLAB web browser to convert the tidied markup to an HTML DOM document. See https://www.w3.org/TR/WD-DOM/introduction.html.
The MATLAB web browser computes the CSS properties of the elements in the HTML input based on internal and external style sheets specified by the input HTML, and on the style attribute of an element. The CSS property computation supports all valid CSS style sheet selectors, including selectors not directly supported by
mlreportgen.dom.HTML
objects.Converts the HTML DOM document to HTML markup that is supported by
mlreportgen.dom.HTML
objects. The style attribute for each element specifies the element CSS properties that the MATLAB web browser computed.Returns the prepared HTML as a string scalar.
prepares the input HTML without first tidying it. Use this syntax if you want to tidy the
HTML markup yourself. For example, you might want to call
preppedHTMLStr
= mlreportgen.utils.html2dom.prepHTMLString(htmlStr
,"Tidy",false)mlreportgen.utils.tidy
with different options than the ones used by
mlreportgen.utils.html2dom.prepHTMLString
, then pass the tidied HTML
as the input to mlreportgen.utils.html2dom.prepHTMLString
.
Examples
Input Arguments
Output Arguments
Tips
MATLAB Report Generator
mlreportgen.dom.HTML
ormlreportgen.dom.HTMLFile
objects 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.prepHTMLString
andmlreportgen.utils.html2dom.prepHTMLFile
functions to prepare the raw HTML for use with themlreportgen.dom.HTML
ormlreportgen.dom.HTMLFile
objects. 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.
Version History
Introduced in R2020a