Class ParentElement
Inheritance
System.Object
ParentElement
Assembly: IronPPT.dll
Syntax
public abstract class ParentElement : ContentElement, ICloneableElement, IParentElement, IContentElement
ParentElement holds and arranges the child content nested inside it. It is the base every container in the slide model inherits, the type that knows how to add, find, reorder, and remove the elements it contains. A developer works with the concrete containers that derive from it, Slide, Paragraph, Run, and Container among them, and uses the members below to build their content. It extends ContentElement, so a container is itself an element inside its own parent.
Because the class is abstract, a container is created as one of its derived types and its children are managed through the inherited members. Code that edits a document tree often holds a container as IParentElement, the contract this class implements, so it can rearrange children without naming the exact container type.
Children is the List<IContentElement> of contained elements. AddChild appends one or more children and InsertChildToIndex places them at a given position, while RemoveChildren, RemoveAllChildren, and the overridden Remove take elements out. GetChildByIndex<T> fetches a typed child by position and ExtractElements<T> pulls every child of a given type from the subtree, which is how a developer collects, say, every run in a paragraph. Clone copies the container and its content, and LogObjectTree returns a text view of the nested structure that is useful while debugging a layout. Build a container's content by adding children, then reorder or extract them through these calls rather than rebuilding the tree.
void Fill(ParentElement container, params IContentElement[] children)
{
container.AddChild(children);
}
The add text how-to covers adding content to a slide, the slide element tutorial walks through the nested element model, and the ContentElement reference documents the element side of the same tree.
Constructors
ParentElement()
Declaration
protected ParentElement()
ParentElement(IContentElement[])
Declaration
public ParentElement(params IContentElement[] children)
Parameters
Properties
Children
Declaration
public List<IContentElement> Children { get; set; }
Property Value
Methods
AddChild(IContentElement[])
Declaration
public virtual void AddChild(params IContentElement[] children)
Parameters
Clone()
Declaration
public override IContentElement Clone()
Returns
Overrides
CloneElement<T>(T)
Declaration
protected static T CloneElement<T>(T original)
where T : ParentElement
Parameters
| Type |
Name |
Description |
| T |
original |
|
Returns
Type Parameters
Declaration
public List<T> ExtractElements<T>()
where T : IContentElement
Returns
| Type |
Description |
| System.Collections.Generic.List<T> |
|
Type Parameters
GetChildByIndex<T>(Int32)
Declaration
public IContentElement GetChildByIndex<T>(int index)
where T : IContentElement
Parameters
| Type |
Name |
Description |
| System.Int32 |
index |
|
Returns
Type Parameters
InsertChildToIndex(Int32, IContentElement[])
Declaration
public void InsertChildToIndex(int index, params IContentElement[] children)
Parameters
LogObjectTree()
Declaration
public string LogObjectTree()
Returns
| Type |
Description |
| System.String |
|
Remove()
Declaration
public override void Remove()
Overrides
RemoveAllChildren()
Declaration
public void RemoveAllChildren()
RemoveChildren(IContentElement[])
Declaration
public void RemoveChildren(params IContentElement[] children)
Parameters
Implements