mlreportgen.dom.Width class

Package: mlreportgen.dom
Superclasses:

Object width

Description

Specifies the width of an object, such as an image or a table entry.

Construction

widthObj = Width() creates a format object that specifies a width of 1 inch.

widthObj = Width(value) creates a width object having the specified width.

Input Arguments

expand all

Width of object, such as an image or a table entry, specified in the form valueUnits, where Units is an abbreviation for the units. These abbreviations are valid:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • % — percent

Output Arguments

expand all

Object width, represented by an mlreportgen.dom.Width object.

Properties

expand all

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.

Tag for the document element, specified as a character vector.

The DOM generates a session-unique tag when it creates the document element. Structure the tag as class:id, where class is the class of the element and id is the value of the Id property. You can specify a tag to replace the generated tag. Specifying your own tag can make it easier to identify where an issue occurred during document generation.

Width of object, such as an image or a table entry, specified in the form valueUnits, where Units is an abbreviation for the units. These abbreviations are valid:

  • px — pixels (default)

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • % — percent of table width

The resulting width of a column depends on the types of widths (absolute or fractional (%) of table width) that you use for each table entry. Setting the width of the entire column, or setting a table entry to resize to fit its contents also affect the resulting column width.

Table Entry Width SettingResulting Column Width
Two or more table entries set to different absolute widthsMaximum of the absolute widths
Two or more table entries set to different fractional widths, expressed as a percent (%) of the table widthMaximum of the fractional widths
Mixture of table entries set to absolute widths and fractional widthsFor PDF output, maximum of the absolute widths.
For all other output formats (for example, Word and HTML), the output application determines the maximum column width to use.
One or more table entry widths set to absolute widths or fractional widths, and the column width set using mlreportgen.dom.TableColSpecGroupMaximum of the specified table entry widths and the column width
One or more table entry widths set to absolute widths or fractional widths, and mlreportgen.dom.ResizeToFitContents set to trueFor PDF output, maximum of the table entry widths.
For all other output formats, maximum of the resized-to-fit table entry widths.

Examples

collapse all

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

t = Table(magic(5));
t.Style = {Border('inset','crimson','6pt'),...
     Width('50%')};

t.TableEntriesInnerMargin = '6pt';     
t.TableEntriesHAlign = 'center';
t.TableEntriesVAlign = 'middle';
append(d,t);

close(d);
rptview('test',doctype);