ClassDocumentFragment
Represents a fragment of a document that can contain various types of content, including text, images, and other document elements. This structure is used for holding a portion of a document for manipulation or transfer.
Definition
Namespace:Telerik.Windows.Documents.Model
Assembly:Telerik.Windows.Controls.RichTextBox.dll
Syntax:
public class DocumentFragment
Inheritance: objectDocumentFragment
Constructors
DocumentFragment(DocumentSelection)
Initializes a new instance of the DocumentFragment class.
Declaration
public DocumentFragment(DocumentSelection documentSelection)
Parameters
documentSelection
The document selection to be added to the fragment.
DocumentFragment(DocumentSelection, bool)
Initializes a new instance of the DocumentFragment class.
Declaration
public DocumentFragment(DocumentSelection documentSelection, bool includeNonCopyableAnnotationMarkers)
Parameters
documentSelection
selection
includeNonCopyableAnnotationMarkers
If true result fragment will contain non-copyable elements like read-only and permission ranges. Otherwise these elements will be removed from the result fragment.
DocumentFragment(RadDocument)
Initializes a new instance of the DocumentFragment class.
Declaration
public DocumentFragment(RadDocument document)
Parameters
document
The document to be added to the fragment.
Properties
IsEmpty
Gets a value indicating whether the fragment is empty.
Declaration
public bool IsEmpty { get; }
Property Value
true if the fragment is empty; otherwise, false.
IsLastParagraphClosed
Gets or sets a value indicating whether the fragment ends with full empty paragraph.
Declaration
public bool IsLastParagraphClosed { get; set; }
Property Value
true if the fragment ends with full empty paragraph; otherwise, false.
Methods
CreateFromInline(Inline)
Creates a fragment from Inline.
Declaration
public static DocumentFragment CreateFromInline(Inline inline)
Parameters
inline
The Inline to add to the fragment.
Returns
EnumerateChildrenOfType<T>()
Enumerates all children of a specified type.
Declaration
public IEnumerable<T> EnumerateChildrenOfType<T>() where T : DocumentElement
Returns
IEnumerable<T>
A collection from the children of the specified type.
GetText()
Converts the fragment to plain text.
Declaration
public string GetText()
Returns
String containing the text representation of the document.
ToDocument()
Converts to this instance to a RadDocument.
Declaration
public RadDocument ToDocument()
Returns
The RadDocument generated from the current instance.