Define a Style Using Format Objects
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
objectsmlreportgen.ppt.Italic
objectsmlreportgen.ppt.Strike
objectsmlreportgen.ppt.Underline
objectsmlreportgen.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.*; ppt = Presentation("myParaPres"); open(ppt); add(ppt,"Title and Content"); add(ppt,"Title and Content"); caution = {FontColor("red"),Bold(true)}; p1 = Paragraph("Hardware Requirements"); p1.Style = caution; p2 = Paragraph("Software Requirements"); p2.Style = caution; titles = find(ppt,"Title"); replace(titles(1),p1); replace(titles(2),p2); close(ppt);
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.