append

Class: mlreportgen.dom.HTMLFile
Namespace: mlreportgen.dom

Append HTML to HTMLFile object

Syntax

htmlObjOut = append(htmlFileObj,htmlText)
htmlObjOut = append(htmlFileObj,htmlObjToAppend)

Description

htmlObjOut = append(htmlFileObj,htmlText) converts HTML string into an HTML object and appends the object to htmlFileObj.

htmlObjOut = append(htmlFileObj,htmlObjToAppend) appends the htmlObjToAppend object to htmlFileObj.

Input Arguments

expand all

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

HTML text, specified as a character vector or string scalar.

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

HTML object to append, specified as an mlreportgen.dom.HTML object.

HTMLFile object to append, specified as an mlreportgen.dom.HTMLFile object.

Output Arguments

expand all

HTML content appended to an HTMLFile object, returned as an mlreportgen.dom.HTML object.

Examples

expand all

Create a text file named myHTMLFile.html and save it in the current folder. Add this text into the file:

<html>
<head>
<style>p {font-size:14pt;}</style>
</head>
<body>
<p style='white-space:pre'><b>Hello</b><i style='color:green'> World</i></p>
</body>
</html>

Create an mlreportgen.dom.HTMLFile object from an HTML file to use for a Microsoft® Word report.

import mlreportgen.dom.*; 
rpt = Document('MyReport','docx'); 
htmlFile = HTMLFile('myHTMLFile.html');

Append content to the mlreportgen.dom.HTMLFile object and append the object to the document.

append(htmlFile,'<p>This is <u>me</u> speaking</p>');
append(rpt,htmlFile);

Generate the report.

close(rpt);
rptview(rpt.OutputPath);

Version History

Introduced in R2015a