Show / Hide Table of Contents

# Class ContentElement

Base class for all content elements in the document content tree. It contains methods to retrieve instances of derived classes via the asDerivedClass() methods. The pattern is to retrieve a MaybeDerivedClass object and then check if it is valid via the isValid() method of the MaybeDerivedClass object. If it is valid, the actual derived instance can be retrieved from the MaybeDerivedClass object.

##### Inheritance

object
ContentElement
ContentNode
TextRun

##### Implements

IDisposable

##### Inherited Members

object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()

###### Namespace: pdftron.Layout

###### Assembly: PDFNet.dll

##### Syntax

    public class ContentElement : IDisposable

### Methods

#### AsContentNode()

Retrieve the associated ContentNode object for this content element

##### Declaration

    public ContentNode AsContentNode()

##### Returns

Type | Description
--- | ---
ContentNode | The ContentNode object or nullptr if the object is not a content node

#### AsList()

Retrieve the associated List object for this content element

##### Declaration

    public List AsList()

##### Returns

Type | Description
--- | ---
List | The List object or nullptr if the object is not a list

#### AsListItem()

Retrieve the associated ListItem object for this content element

##### Declaration

    public ListItem AsListItem()

##### Returns

Type | Description
--- | ---
ListItem | The ListItem object or nullptr if the object is not a list item

#### AsParagraph()

Retrieve the associated Paragraph object for this content element

##### Declaration

    public Paragraph AsParagraph()

##### Returns

Type | Description
--- | ---
Paragraph | The Paragraph object or nullptr if the object is not a paragraph

#### AsTable()

Retrieve the associated Table object for this content element

##### Declaration

    public Table AsTable()

##### Returns

Type | Description
--- | ---
Table | The Table object or nullptr if the object is not a table

#### AsTableCell()

Retrieve the associated TableCell object for this content element

##### Declaration

    public TableCell AsTableCell()

##### Returns

Type | Description
--- | ---
TableCell | The TableCell object or nullptr if the object is not a table cell

#### AsTableRow()

Retrieve the associated TableRow object for this content element

##### Declaration

    public TableRow AsTableRow()

##### Returns

Type | Description
--- | ---
TableRow | The TableRow object or nullptr if the object is not a table row

#### AsTextRun()

Retrieve the associated TextRun object for this content element

##### Declaration

    public TextRun AsTextRun()

##### Returns

Type | Description
--- | ---
TextRun | The TextRun object or nullptr if the object is not a text run

#### Dispose()

##### Declaration

    public override sealed void Dispose()

#### Dispose(bool)

##### Declaration

    [HandleProcessCorruptedStateExceptions]
    protected virtual void Dispose(bool A_0)

##### Parameters

Type | Name | Description
--- | --- | ---
bool | A_0 |

#### ~ContentElement()

##### Declaration

    protected ~ContentElement()

#### GetTextStyledElement()

Retrieve the TextStyledElement object for manipulating the text style

##### Declaration

    public TextStyledElement GetTextStyledElement()

##### Returns

Type | Description
--- | ---
TextStyledElement | The TextStyledElement object

### Implements

IDisposable