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

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

expand 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);
Was this topic helpful?