GemBox.Document
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    Element Class

    Namespace:
    GemBox.Document
    Assembly:
    GemBox.Document.dll

    Represents a base class for all document elements.

    • C#
    • VB.NET
    public abstract class Element
    Public MustInherit Class Element
    Inheritance:
    System.Object
    Element
    Derived
    Block
    Comment
    DocumentModel
    HeaderFooter
    Inline
    Section
    TableCell
    TableRow
    Remarks

    All document content elements contain properties like ElementType, Document and Parent. These properties are defined on an Element class - a base class for all document elements.

    For more information, see GemBox.Document Content Model.

    Properties

    Content

    Gets the content of the current Element.

    • C#
    • VB.NET
    public ContentRange Content { get; }
    Public ReadOnly Property Content As ContentRange
    Property Value
    ContentRange

    The content of the current Element.

    Remarks

    For more information, see Get Content example.

    Document

    Gets the owner document.

    • C#
    • VB.NET
    public virtual DocumentModel Document { get; }
    Public Overridable ReadOnly Property Document As DocumentModel
    Property Value
    DocumentModel

    The owner document.

    ElementType

    Gets the ElementType of this Element instance.

    • C#
    • VB.NET
    public abstract ElementType ElementType { get; }
    Public MustOverride ReadOnly Property ElementType As ElementType
    Property Value
    ElementType

    The ElementType of this Element instance.

    Parent

    Gets the parent of this Element instance.

    • C#
    • VB.NET
    public Element Parent { get; }
    Public ReadOnly Property Parent As Element
    Property Value
    Element

    The parent of this Element instance.

    ParentCollection

    Gets the ElementCollection that contains this Element instance.

    • C#
    • VB.NET
    public ElementCollection ParentCollection { get; }
    Public ReadOnly Property ParentCollection As ElementCollection
    Property Value
    ElementCollection

    The ElementCollection that contains this Element instance.

    Methods

    Clone(Boolean)

    Clones this Element instance, and optionally clones it's descendants.

    • C#
    • VB.NET
    public Element Clone(bool cloneDescendants)
    Public Function Clone(cloneDescendants As Boolean) As Element
    Parameters
    cloneDescendants
    System.Boolean

    true to clone descendants; otherwise false.

    Returns
    Element

    Cloned Element.

    Remarks

    Document content element instance can exist only in a one place in the document.

    If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.

    If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.

    For more information, see cloning example.

    GetChildElements(Boolean)

    Gets the child elements.

    • C#
    • VB.NET
    public IEnumerable<Element> GetChildElements(bool recursively)
    Public Function GetChildElements(recursively As Boolean) As IEnumerable(Of Element)
    Parameters
    recursively
    System.Boolean

    true to get all descendants elements; otherwise false to get just child elements.

    Returns
    System.Collections.Generic.IEnumerable<Element>

    Sequence of child elements.

    GetChildElements(Boolean, ElementType[])

    Gets the child elements filtered by ElementType.

    • C#
    • VB.NET
    public IEnumerable<Element> GetChildElements(bool recursively, params ElementType[] filterElements)
    Public Function GetChildElements(recursively As Boolean, ParamArray filterElements As ElementType()) As IEnumerable(Of Element)
    Parameters
    recursively
    System.Boolean

    true to get all descendants elements; otherwise false to get just child elements.

    filterElements
    ElementType[]

    The ElementTypes to filter by.

    Returns
    System.Collections.Generic.IEnumerable<Element>

    Sequence of child elements filtered by ElementType.

    GetParentElements()

    Gets the parent elements.

    • C#
    • VB.NET
    public IEnumerable<Element> GetParentElements()
    Public Function GetParentElements As IEnumerable(Of Element)
    Returns
    System.Collections.Generic.IEnumerable<Element>

    Sequence of parent elements.

    GetParentElements(ElementType[])

    Gets the parent elements.

    • C#
    • VB.NET
    public IEnumerable<Element> GetParentElements(params ElementType[] filterElements)
    Public Function GetParentElements(ParamArray filterElements As ElementType()) As IEnumerable(Of Element)
    Parameters
    filterElements
    ElementType[]

    The ElementTypes to filter by.

    Returns
    System.Collections.Generic.IEnumerable<Element>

    Sequence of parent elements.

    Examples

    Get Content example
    Iterating example
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.