[]
Base class representing a content object in a document.
Derived classes include FormattedContentObject, ContentMark, Text, UnknownContent, CommentInfo, SeparatorMark, ContinuationSeparatorMark, Footnote, Endnote, EndnoteReferenceMark, FootnoteReferenceMark, Hyperlink, SimpleField, ControlContent, SectionBreak, ShapeBase, TextFrame, LinkedTextFrame, OMathParagraph, OMath, OMathStruct, OMathElement, OMathMatrixRow.
public class ContentObject
Gets the collection of the children of this content object.
public IEnumerable<ContentObject> Children { get; }
Gets the DocumentBase that contains this content object.
public DocumentBase Document { get; }
Gets the Marker representing the end of this content object in the parent body.
public Marker End { get; }
Gets the content unique identifier.
public string Guid { get; }
Gets the parent Body of this content object.
public Body ParentBody { get; }
Gets the parent ContentObject of this content object.
public ContentObject ParentContent { get; }
Gets the Marker representing the start of this content object in the parent body.
public Marker Start { get; }
Checks whether a ContentObject of the specified type can be added to the current object.
public bool CanAdd(Type contentObjectType, out Exception ex)
contentObjectType
System.TypeThe type of the content object to add.
ex
System.ExceptionOUT: the exception that would be thrown if a content object of the specified type was added.
true if a content object of the specified type can be added, false otherwise.
Checks whether a ContentObject of the specified type can be added to the current object.
public bool CanAdd(Type contentObjectType)
contentObjectType
System.TypeThe type of the content object to add.
true if a content object of the specified type can be added, false otherwise.
Checks whether a ContentControl of the specified type can be added to the current object.
public bool CanAddContentControl(ContentControlType type, out Exception ex)
type
ContentControlTypeThe type of the content control to add.
ex
System.ExceptionOUT: the exception that would be thrown if a content control of the specified type was added.
true if a content control of the specified type can be added, false otherwise.
Checks whether a ContentControl of the specified type can be added to the current object.
public bool CanAddContentControl(ContentControlType type)
type
ContentControlTypeThe type of the content control to add.
true if a content control of the specified type can be added, false otherwise.
Deletes this content object from the parent Body.
Note that the position occupied by this content object in the parent can still be accessed (e.g. to insert new content) via a PersistentRange if one has previously been created with GetPersistentRange().
public virtual void Delete()
Gets the collection of this content object's children of a specified type.
public IReadOnlyList<T> GetChildren<T>() where T : ContentObject
A readonly list of this object's children with the specified type.
T
The requested type of child objects.
Creates and returns a PersistentRange associated with this content object.
Unlike the Range returned by GetRange(), this persistent range and any markers on it (see Start and End) can still be used if the object is deleted.
Note that PersistentRange should be disposed when no longer needed to improve performance.
public PersistentRange GetPersistentRange()
A new PersistentRange instance associated with this content object.
Creates and returns a Range associated with this content object.
To get a range that can be used after the object has been deleted, see GetPersistentRange().
public Range GetRange()
Gets string representation of the content.
public override string ToString()
String representation of the content.