Main Content

mlreportgen.dom.Display Class

Namespace: mlreportgen.dom

Display option for DOM objects

Description

For Microsoft® Word reports, specifies whether to display an mlreportgen.dom.Text object. For HTML reports, specifies how to display DOM objects such as text, paragraphs, images, and list items.

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

Creation

Description

disp = Display in an HTML report displays a DOM object as an inline element. Word reports ignore mlreportgen.dom.Display objects that you create with this syntax.

example

disp = Display(value) applies the specified display value to the DOM object. For Word reports, the display option you can use is none and the only DOM object it applies to is a Text object.

Input Arguments

expand all

Display option, specified as a character vector. The default option is inline.

For Microsoft Word and PDF reports, the only supported option is none.

ValueDisplay of Text or Paragraph Object

'inline'

Inline element (similar to an HTML <span> element). (Default)

'block'

Block element (similar to an HTML <span> element).

'flex'

Block-level flex container.

'initial'

Uses the default value of inline.

'inline-block'

Inline-level block container. Displays the inside of the block as a block-level box, and formats the object itself as an inline-level box.

'inline-flex'

Inline-level flex container.

'inline-table'

Inline-level table.

'list-item'

Similar to an HTML <li> bulleted list element.

'none'

Not displayed (has no effect on layout).

This is the only display option that applies to Word and PDF reports. In Word, if you enable File > Options > Display > Hidden text, the text displays in the report.

'run-in'

As block or inline, depending on the context. For example, if the object is inside a block, the object displays as a block.

'table'

Similar to an HTML <table> element.

'table-caption'

Similar to an HTML <caption> element.

'table-cell'

Similar to an HTML <td> element.

'table-column'

Similar to an HTML <col> element.

'table-column-group'

Similar to an HTML <colgroup> element.

'table-footer-group'

Similar to an HTML <tfoot> element.

'table-header-group'

Similar to an HTML <thead> element.

'table-row'

Similar to an HTML <tr> element.

'table-row-group'

Similar to an HTML <tbody> element.

Note

The Display class does not support the CSS display value of inherit.

For details about the CSS display property, see https://www.w3schools.com/cssref/pr_class_display.php.

Properties

expand all

Display option, specified as a character vector. For a list of options, see the description of the value constructor input argument.

Tag for mlreportgen.dom.Display 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

Object identifier for mlreportgen.dom.Display 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

Examples

collapse all

In Word, make sure the File > Options > Display > Hidden text option is cleared. This is the default setting.

import mlreportgen.dom.*;
rpt = Document('MyDispRep','docx');
t1 = Text('Hello');
t1.Style = {Display('none')};
p1 = Paragraph();
append(p1,t1);
t2 = Text('World');
append(p1,t2);
append(rpt,p1);
close(rpt);
rptview('MyDispRep','docx');

Version History

Introduced in R2015b