This example shows the relationship between the formats of a paragraph and a copy of the paragraph.
When you set a format property in a mlreportgen.ppt.Paragraph
object, the PPT API adds a corresponding format object to the Style
property of the Paragraph
object. When you clone a Paragraph
object, the copy has the same format property values and includes the same format objects as the source Paragraph
object. If you change a format setting in a shared format object, the source Paragraph
object and the copy reflect the change. If you change a format property of the source Paragraph
object or the copy, the PPT API adds a new format object to the Style
property of the object that you changed. Because the source Paragraph
object and the copy no longer share the same format object, the change to the format property in one of the Paragraph
objects does not affect the other object.
Create an mlreportgen.ppt.Paragraph
object with the Bold
and Italic
properties set to true
.
The PPT API sets the Style
property of the Paragraph
object to a cell array that contains an mlreportgen.ppt.Bold
object with Value
set to true
and an mlreportgen.ppt.Italic
object with Value
set to true
.
ans=1×2 cell array
{1×1 mlreportgen.ppt.Bold} {1×1 mlreportgen.ppt.Italic}
Clone the Paragraph
object. The Bold
, Italic
, and
Style
property values are the same as those of the source Paragraph
object.
ans=1×2 cell array
{1×1 mlreportgen.ppt.Bold} {1×1 mlreportgen.ppt.Italic}
In the Style
property of the source Paragraph
object, set the Value
property of the Italic
object to false
. This change affects the copy of the Paragraph
object because its Style
property includes the same Italic
object as the source Paragraph
object. The PPT API sets the value of the Italic
property of the Paragraph
copy to false
so that it matches the value of the Italic
object included in the Style
property.
In the copy of the Paragraph
object, set the Bold
property to false
. This change does not affect the source Paragraph object. In the source Paragraph
object, the Bold
property is still true
.