A format object is a MATLAB® program entity that defines the properties and functions of a specific type of presentation format, such as the weight for text (bold or regular). The PPT API provides a set of constructors for creating several format objects, including:
mlreportgen.ppt.Bold
objects
mlreportgen.ppt.Italic
objects
mlreportgen.ppt.Strike
objects
mlreportgen.ppt.Underline
objects
mlreportgen.ppt.FontColor
objects
Most PPT API presentation element objects, such as Text
objects,
include a Style
property that you can set to a cell array of format
objects that defines the appearance of the object. For example, to specify the default
format for text in a paragraph is red bold text.
p = Paragraph('Model Highlights'); p.Style = {FontColor('red'),Bold(true)};
You can assign the same array of format objects to more than one PPT API presentation element object. This allows you to create a programmatic equivalent of a template style sheet. For example:
import mlreportgen.ppt.*; slides = Presentation('myParaPres'); add(slides,'Title and Content'); add(slides,'Title and Content'); caution = {FontColor('red'),Bold(true)}; p1 = Paragraph('Hardware Requirements'); p1.Style = caution; p2 = Paragraph('Software Requirements'); p2.Style = caution; titles = find(slides,'Title'); replace(titles(1),p1); replace(titles(2),p2); close(slides);
The PPT API allows you to assign any format object to any presentation object, regardless of whether the format is appropriate for that object type. Format that are not appropriate are ignored.