Interface IParentElement
Assembly: IronPPT.dll
Syntax
public interface IParentElement : IContentElement
IParentElement lets a developer add, find, reorder, and remove the child elements nested inside a slide object. It is the contract every container in the presentation tree shares, so the same calls that add a shape to a slide also add a run to a paragraph or a paragraph to a text box. Reach for it when code walks or edits the document hierarchy generically rather than against one specific container type.
A developer receives an IParentElement from the element being built rather than constructing one. The concrete implementors in IronPPT include Slide, Shape, TextBox, and Container, along with text-bearing elements such as Paragraph and Run; each is something that can hold children. Because IParentElement extends IContentElement, a parent is also a positioned element that can itself be nested inside another parent, which is what makes the tree recursive.
The members group into three jobs. For mutation, AddChild appends one or more children, InsertChildToIndex places them at a position, RemoveChildren removes specific children, RemoveAllChildren clears them, and Remove detaches the parent itself; Clone copies it. For iteration and lookup, Children lists the contained IContentElement items, GetChildByIndex<T> returns the child at a position, and ExtractElements<T> collects every descendant of a given element type across the subtree. For observability, LogObjectTree prints the hierarchy as text, which is useful when debugging a layout or confirming that children landed where the code intended.
slide.AddChild(textBox);
List<IText> texts = slide.ExtractElements<IText>();
slide.LogObjectTree();
The add slide how-to covers building slide content, the slide element tutorial walks through the element tree these calls traverse, and the add shape example shows a child element being attached to a parent.
Properties
Children
Declaration
List<IContentElement> Children { get; set; }
Property Value
Methods
AddChild(IContentElement[])
Declaration
void AddChild(params IContentElement[] children)
Parameters
Clone()
Declaration
Returns
Declaration
List<T> ExtractElements<T>()
where T : IContentElement
Returns
| Type |
Description |
| System.Collections.Generic.List<T> |
|
Type Parameters
GetChildByIndex<T>(Int32)
Declaration
IContentElement GetChildByIndex<T>(int index)
where T : IContentElement
Parameters
| Type |
Name |
Description |
| System.Int32 |
index |
|
Returns
Type Parameters
InsertChildToIndex(Int32, IContentElement[])
Declaration
void InsertChildToIndex(int index, params IContentElement[] children)
Parameters
LogObjectTree()
Declaration
Returns
| Type |
Description |
| System.String |
|
Remove()
Declaration
RemoveAllChildren()
Declaration
RemoveChildren(IContentElement[])
Declaration
void RemoveChildren(params IContentElement[] children)
Parameters