User`s guide
Use Format Objects
13-23
Use Format Objects
A format object is a MATLAB program entity that defines the properties and functions
of a specific type of document format, such as a font family or font size. The DOM API
provides a set of constructors for creating format objects corresponding to most of the
formatting options available in HTML and Word documents. Most DOM document
objects include a Style property that you can set to a cell array of format objects.
Together, format objects and the document object Style property allow you to format a
document object by creating an array of format objects that define the appearance (style),
of the object and assigning this array to the Style property of the document object.
For example, the following script uses format objects to specify the style of a warning
paragraph.
p = Paragraph('Danger!');
p.Style = {Color('red'),FontFamily('Arial'),FontSize('18pt')};
You can assign the same array of format objects to more than one DOM document object.
This allows you to create a programmatic equivalent of a template style sheet. For
example:
warning = {Color('red'), FontFamily('Arial'), FontSize('18pt')};
p = Paragraph('Danger!');
p.Style = warning;
p = Paragraph('Caution!');
p.Style = warning;
The DOM API allows you to assign any format object to any document object, regardless
of whether the format applies. If the format does not apply, it is ignored.
More About
• “Report Formatting Approaches” on page 13-20
• “Format Inheritance” on page 13-25