Class ContentElement
Inheritance
System.Object
ContentElement
Assembly: IronPPT.dll
Syntax
public abstract class ContentElement : Object, ICloneableElement, IContentElement
Every piece of content that lives inside a slide, a paragraph, a graphic, an image, a list level, shares one base: ContentElement. It defines what it means for an element to sit somewhere in the document tree, know its position, and be cloned, removed, or replaced. A developer meets it through the concrete elements that derive from it rather than on its own, and the shared members below explain behavior the whole content family has in common.
Because the class is abstract, an element is created as a concrete type, ParentElement, BaseGraphic, ImageContent, ListLevel, or TextContentElement among them, and is then handled through the members this base provides. Code that walks or edits a document often holds an element as IContentElement (the contract this class implements), so the tree can be traversed without knowing each exact type.
Parent is the read-only IParentElement that contains the element, and Index is its position among its siblings. Status is an ElementStatus describing the element's state. Remove detaches the element from its parent, Replace swaps in a new IContentElement in its place, and Clone returns an independent copy; the last two are virtual, so derived types refine them. Together these make the document tree editable: an element knows where it sits, can be cloned to seed another, and can be removed or replaced without rebuilding the elements around it.
void Swap(ContentElement element, IContentElement replacement)
{
element.Replace(replacement);
}
The add text how-to covers adding content to a slide, the slide element tutorial walks through the element model, and the ParentElement reference documents the container side of the same tree.
Constructors
ContentElement()
Declaration
protected ContentElement()
Fields
_Index
Declaration
Field Value
| Type |
Description |
| System.Int32 |
|
Properties
Index
Declaration
public int Index { get; set; }
Property Value
| Type |
Description |
| System.Int32 |
|
Parent
Declaration
public IParentElement Parent { get; }
Property Value
Status
Declaration
public ElementStatus Status { get; set; }
Property Value
Methods
CaptureInitialValues()
Declaration
protected void CaptureInitialValues()
Clone()
Declaration
public virtual IContentElement Clone()
Returns
CloneObject<T>(T)
Declaration
protected static T CloneObject<T>(T original)
where T : IContentElement
Parameters
| Type |
Name |
Description |
| T |
original |
|
Returns
Type Parameters
GetIndex()
Declaration
Returns
| Type |
Description |
| System.Int32 |
|
Remove()
Declaration
public virtual void Remove()
Replace(IContentElement)
Declaration
public void Replace(IContentElement newChild)
Parameters
Implements