Defines utility class used for editing RadFlowDocument
Definition
Namespace:Telerik.Windows.Documents.Flow.Model.Editing
Assembly:Telerik.Windows.Documents.Flow.dll
Syntax:
public class RadFlowDocumentEditor
Inheritance: objectRadFlowDocumentEditor
Constructors
Initializes a new instance of the RadFlowDocumentEditor class.
public RadFlowDocumentEditor(RadFlowDocument document)
The document.
Methods
Removes the specified bookmark from the document, deleting its range markers.
Removes the bookmark with the specified name from the document, deleting its range markers.
Removes all content between the start and end inline elements within the same block container, optionally including the boundary elements.
public void DeleteContent(InlineBase start, InlineBase end, bool inclusive = true)
The start inline element.
endInlineBaseThe end inline element.
inclusiveboolIndicates if the start end elements should be deleted as well.
Removes the specified permission range from the document, deleting its range markers.
public void DeletePermissionRange(PermissionRange permission)
The permission.
Searches the document for all matches of the specified regular expression and returns their positions and associated runs.
public ReadOnlyCollection<FindResult> FindAll(Regex regex)
The regex.
Returns:ReadOnlyCollection<FindResult>
Collection of type FindResult.
Searches the document for all occurrences of the specified text and returns their positions and associated runs.
public ReadOnlyCollection<FindResult> FindAll(string text, bool matchCase = true, bool matchWholeWord = false)
The searched text.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
Returns:ReadOnlyCollection<FindResult>
Collection of type FindResult.
Creates a bookmark with the specified name and inserts its range markers to span from before inlineStart to after inlineEnd.
public Bookmark InsertBookmark(string name, InlineBase inlineStart, InlineBase inlineEnd)
The name.
inlineStartInlineBaseThe inline start. The start of the bookmark will be inserted before this inline.
inlineEndInlineBaseThe inline end. The end of the bookmark will be inserted after this inline.
Returns:The created bookmark.
Inserts the range markers of an existing comment to span from before inlineStart to after inlineEnd.
public Comment InsertComment(Comment comment, InlineBase inlineStart, InlineBase inlineEnd)
The comment.
inlineStartInlineBaseThe inline start. The start of the comment will be inserted before this inline.
inlineEndInlineBaseThe inline end. The end of the comment will be inserted after this inline.
Returns:The comment.
Creates a comment with the specified text and inserts its range markers to span from before inlineStart to after inlineEnd.
public Comment InsertComment(string text, InlineBase inlineStart, InlineBase inlineEnd)
The text.
inlineStartInlineBaseThe inline start. The start of the comment will be inserted before this inline.
inlineEndInlineBaseThe inline end. The end of the comment will be inserted after this inline.
Returns:Merges the source document into this document at the current position using the specified options for conflict resolution.
public void InsertDocument(RadFlowDocument sourceDocument, InsertDocumentOptions insertOptions)
The source document.
insertOptionsInsertDocumentOptionsThe insert options.
Inserts the source document at the current position in the target document.
public void InsertDocument(RadFlowDocument sourceDocument)
The source document.
Inserts a floating image with the specified source and explicit size, positioned absolutely with text wrapping support.
public FloatingImage InsertFloatingImage(ImageSource source, Size size)
The image source.
sizeSizeThe size.
Returns:The floating image inline.
Inserts a floating image from a stream with the specified size, positioned absolutely with text wrapping support.
Inserts a hyperlink field with the specified display text and target URI or bookmark anchor, applying the Hyperlink style.
Inserts an inline image with the specified source and explicit size at the current position.
public ImageInline InsertImageInline(ImageSource source, Size size)
The image source.
sizeSizeThe size.
Returns:The inserted image inline.
Inserts an existing inline element at the current position and advances the cursor past it.
public InlineBase InsertInline(InlineBase inline)
The inline.
Returns:The inline.
Inserts a new paragraph at the current position with the current paragraph formatting and moves the cursor to its start.
Creates a permission range with the specified credentials and inserts its markers to span from before inlineStart to after inlineEnd.
public PermissionRange InsertPermissionRange(PermissionRangeCredentials permissionRangeCredentials, InlineBase inlineStart, InlineBase inlineEnd)
The permission range credentials.
inlineStartInlineBaseThe inline start.
inlineEndInlineBaseThe inline end.
Returns:Creates a permission range with the specified credentials and inserts its markers to protect the entire table cell.
public PermissionRange InsertPermissionRange(PermissionRangeCredentials permissionRangeCredentials, TableCell cell)
The permission range credentials.
cellTableCellThe cell.
Returns:Creates a permission range with the specified credentials and inserts its markers to protect the entire table row.
public PermissionRange InsertPermissionRange(PermissionRangeCredentials permissionRangeCredentials, TableRow row)
The permission range credentials.
rowTableRowThe row.
Returns:Inserts a new section at the current position, providing a container for blocks with independent page settings.
Inserts a content control with the specified properties wrapping the range from before the start element to after the end element and returns its start marker.
public SdtRangeStart InsertStructuredDocumentTag(SdtProperties properties, DocumentElementBase startElement, DocumentElementBase endElement)
The properties of the SDT.
startElementDocumentElementBaseThe start of the SDT will be inserted before the provided element.
endElementDocumentElementBaseThe end of the SDT will be inserted after the provided element.
Returns:Inserts a content control with the specified properties at the current cursor position and returns its start marker.
public SdtRangeStart InsertStructuredDocumentTag(SdtProperties properties)
The properties of the SDT.
Returns:Inserts a content control wrapping the range from before the start element to after the end element and returns its start marker.
public SdtRangeStart InsertStructuredDocumentTag(SdtType type, DocumentElementBase startElement, DocumentElementBase endElement)
The type for the SDT to be generated.
startElementDocumentElementBaseThe start of the SDT will be inserted before the provided element.
endElementDocumentElementBaseThe end of the SDT will be inserted after the provided element.
Returns:Inserts a content control of the specified type at the current cursor position and returns its start marker.
public SdtRangeStart InsertStructuredDocumentTag(SdtType type)
The type for the SDT to be generated.
Returns:Inserts an empty table at the current position with the current table formatting and moves the cursor after it.
Inserts a table with the specified number of rows and columns, applying current formatting, and moves the cursor after it.
Positions the cursor immediately after the specified inline element.
Positions the cursor immediately before the specified inline element.
Positions the cursor at the end of the specified paragraph, after all inline elements.
Positions the cursor at the start of the specified paragraph, before all inline elements.
public void MoveToParagraphStart(Paragraph paragraph)
The paragraph.
Positions the cursor immediately after the specified table.
Enables protection on the document with the specified password and protection mode, using SHA-512 hashing.
public void Protect(string password, ProtectionMode protectionMode)
The password.
protectionModeProtectionModeThe protection mode.
Enables read-only protection on the document with the specified password, using SHA-512 hashing.
Removes the content control, optionally preserving or deleting its enclosed content.
public void RemoveStructuredDocumentTag(SdtRangeStart sdtRangeStart, bool removeContent)
The start of the SDT to be removed.
removeContentboolIf true the content of the SDT is removed; else only the SDT is removed leaving behind the content.
Removes the content control and all its enclosed content from the document.
public void RemoveStructuredDocumentTag(SdtRangeStart sdtRangeStart)
The start of the SDT to be removed.
Searches the document for all matches of the specified regular expression and applies the formatting action to the matching runs.
public void ReplaceStyling(Regex regex, Action<CharacterProperties> replacePropertiesAction)
The regex.
replacePropertiesActionAction<CharacterProperties>The action which replaces character properties.
Searches the document for all occurrences of the specified text and applies the formatting action to the matching runs.
public void ReplaceStyling(string searchedText, Action<CharacterProperties> replacePropertiesAction)
The searched text.
replacePropertiesActionAction<CharacterProperties>The action which replaces character properties.
Searches the document for all occurrences of the specified text and applies the formatting action to the matching runs.
public void ReplaceStyling(string searchedText, bool matchCase, bool matchWholeWord, Action<CharacterProperties> replacePropertiesAction)
The searched text.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
replacePropertiesActionAction<CharacterProperties>The action which replaces character properties.
Searches the document for all matches of the specified regular expression and replaces them with the specified block elements.
public void ReplaceText(Regex regex, IEnumerable<BlockBase> blocks)
The regex.
blocksIEnumerable<BlockBase>The replace IEnumerable<T> elements.
Searches the document for all matches of the specified regular expression and replaces them with the specified inline elements.
public void ReplaceText(Regex regex, IEnumerable<InlineBase> inlines)
The regex.
inlinesIEnumerable<InlineBase>The replace IEnumerable<T> elements.
Searches the document for all matches of the specified regular expression and replaces them with the specified inline element.
public void ReplaceText(Regex regex, InlineBase inline)
The regex.
inlineInlineBaseThe replace InlineBase elements.
Searches the document for all occurrences of the specified text and replaces them with the specified block element.
public void ReplaceText(string oldText, BlockBase block, bool matchCase = true, bool matchWholeWord = false)
The searched text.
blockBlockBaseThe replace BlockBase elements.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
Searches the document for all occurrences of the specified text and replaces them with the specified block elements.
public void ReplaceText(string oldText, IEnumerable<BlockBase> blocks, bool matchCase = true, bool matchWholeWord = false)
The searched text.
blocksIEnumerable<BlockBase>The replace IEnumerable<T> elements.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
Searches the document for all occurrences of the specified text and replaces them with the specified inline elements.
public void ReplaceText(string oldText, IEnumerable<InlineBase> inlines, bool matchCase = true, bool matchWholeWord = false)
The searched text.
inlinesIEnumerable<InlineBase>The replace IEnumerable<T> elements.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
Searches the document for all occurrences of the specified text and replaces them with the specified inline element.
public void ReplaceText(string oldText, InlineBase inline, bool matchCase = true, bool matchWholeWord = false)
The searched text.
inlineInlineBaseThe replace InlineBase elements.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
Searches the document for all occurrences of the specified text and replaces them with the new text.
public void ReplaceText(string oldText, string newText, bool matchCase = true, bool matchWholeWord = false)
The searched text.
newTextstringThe replace text.
matchCaseboolIndicates whether the casing should be matched.
matchWholeWordboolIndicates whether only whole words should be matched.
Configures a custom message provider to display messages during content control creation operations.
public void SetSdtMessageProvider(IMessageProvider provider)
A custom message provider which implements IMessageProvider.
Applies the specified watermark to the section's header of the specified type, creating the header if needed.
public void SetWatermark(Watermark watermark, Section section, HeaderFooterType headerType)
The watermark.
sectionSectionThe section.
headerTypeHeaderFooterTypeType of the header.
Removes all protection from the document without password validation.
public void Unprotect()
Properties
Gets the character formatting applied to newly inserted text runs, including font, size, color, and styles.
public CharacterProperties CharacterFormatting { get; }
The character formatting.
Gets the document being edited by this editor instance.
public RadFlowDocument Document { get; }
The document.
Gets the paragraph formatting applied to newly inserted paragraphs, including alignment, spacing, and indentation.
public ParagraphProperties ParagraphFormatting { get; }
The paragraph formatting.
Gets the table formatting applied to newly inserted tables, including borders, cell spacing, and alignment.
public TableProperties TableFormatting { get; }
The table formatting.