Main Content

mlreportgen.dom.RawText Class

Namespace: mlreportgen.dom

Microsoft Word XML or HTML markup to insert in document

Description

Microsoft® Word XML or HTML markup to insert in a document.

The mlreportgen.dom.RawText class is a handle class.

Creation

Description

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.

example

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, Word, or PDF).

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 Microsoft 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.

Properties

expand all

Word XML markup text to output to a Word document, specified as a character vector or string scalar. If the document is of type "docx", it includes the value of this property. The markup must be valid Word XML markup that can be inserted into the w:body, w:p, or w:tc element of a Word document.

Attributes:

NonCopyable
true

Data Types: char | string

HTML markup text to output to an HTML document, specified as a character vector or string scalar. If the document is of type "html", "html-file", or "html-multipage", it includes the value of this property. The text must be valid HTML markup that can be inserted into a body, p, or td element of an HTML document.

Attributes:

NonCopyable
true

Data Types: char | string

Formatting Objects markup to output to a PDF document, specified as a character vector or string scalar. If the document is of type "pdf", it includes the value of this property. The value of this property must be valid Formatting Objects (FO) markup that can be inserted into a fo:flow, fo:block, or fo:table-cell element of the FO representation of PDF document content. For more information on FO, see https://www.w3.org/TR/xsl11/.

Attributes:

NonCopyable
true

Data Types: char | string

Object identifier for mlreportgen.dom.RawText object, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Parent of mlreportgen.dom.RawText object, specified as a document element object. A document element must have only one parent.

Attributes:

SetAccess
private
NonCopyable
true

Tag for mlreportgen.dom.RawText object, specified as a character vector or string scalar. The DOM API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse 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');

Version History

Introduced in R2014b