Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

mlreportgen.dom.RawText class

Package: mlreportgen.dom
Superclasses:

Word XML or HTML markup to insert in document

Description

Word XML or HTML markup to insert in a document.

Construction

text = RawText() creates an empty RawText object.

You can append a RawText object only to a Document object. For a Word document, the markup specified by the DOCXText property is included in the document. For an HTML document, the value of the HTMLText property is included. In either case, the markup must be valid Word XML or HTML markup, respectively, that can be validly inserted in the body element of the output document. If you insert invalid markup in a Microsoft® Word document, Word may be unable to open the document.

text = RawText(htmlMarkup) creates a RawText object containing the specified HTML markup.

text = RawText(markup,doctype) creates a RawText object containing markup of the specified document type (HTML or Word).

Input Arguments

expand all

HTML markup, specified as a character vector. To improve the readability of your report document, consider assigning the markup to a variable. Then use the variable as an input argument, as shown in the example below.

Word XML markup or HTML markup, specified as a character vector. For a Word document, the markup must be valid Word XML markup that can be inserted into the w:body element. To improve the readability of your report document, consider assigning the markup to a variable. Then use the variable as an input argument, as shown in the example below.

Type of markup to use, specified as a character vector.

Output Arguments

expand all

Word XML or HTML markup to insert in document, represented by an mlreportgen.dom.RawText object.

Properties

expand all

Word XML markup, specified as a character vector. The value of this property is included in a Word document. The markup must be valid Word XML markup that can be inserted into the w:body element of a Word document.

HTML markup, specified as a character vector. The value of this property is included in an HTML document. The text must be valid HTML markup that can be inserted into the body element of an HTML document.

ID for this document element, specified as a character vector. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

This read-only property lists the parent of this document element.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.

Examples

expand all

Assign HTML markup to a variable and use that variable to create a RawText object to append to a document.

import mlreportgen.dom.*;
d = Document('test','html');

script = [ ...
   '<script>' ...
   'document.write("Hello World!")' ...
   '</script>' ...
   ];
append(d,RawText(script));

close(d);
rptview('test','html');
Was this topic helpful?