Main Content

mlreportgen.dom.Width Class

Namespace: mlreportgen.dom

Object width

Description

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

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

Creation

Description

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

example

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

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • % — percent

Properties

expand all

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

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

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

  • cm — centimeters

  • in — inches

  • mm — millimeters

  • pc — picas

  • pt — points

  • % — percent

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

Version History

Introduced in R2014b