User`s guide

mlreportgen.dom.Paragraph.clone
11-83
When you clone a paragraph, DOM copies all of the children objects of the source
paragraph, but not the parent of the paragraph.
The cloned paragraph includes formats that you set in the source paragraph. The
cloned paragraph formats use the same format objects as the source paragraph. If
you change the format setting in the shared format object, the source and cloned
paragraphs reflect that change.
If you change a format setting in the cloned paragraph, then DOM creates a new
format object for the cloned paragraph, using the new format setting. For that format,
the source and cloned paragraph no longer share the same format object.
This example shows the relationship between the formats for the source and cloned
paragraphs.
1
Create a paragraph that uses a style that sets the Bold and Italic formats to
true.
import mlreportgen.dom.*;
myReport = Document('myDoc','html');
p = Paragraph('This is a paragraph');
append(myReport,p);
MyStyle = {Bold,Italic};
p.Style = MyStyle;
p.Bold
ans =
1
p.Italic
ans =
1
2
Clone the paragraph. The Bold and Italic formats are the same as those of the
source paragraph.
pClone = clone(p);
pClone.Bold
ans =
1