Class SelectionModule
Represents the selection module in DocumentEditor.
Inheritance
Namespace: Syncfusion.Blazor.DocumentEditor
Assembly: Syncfusion.Blazor.DocumentEditor.dll
Syntax
public class SelectionModule : Object
Constructors
SelectionModule(SfDocumentEditor)
Initializes a new instance of the SelectionModule class. Default constructor for Selection.
Declaration
public SelectionModule(SfDocumentEditor baseComponent)
Parameters
| Type | Name | Description |
|---|---|---|
| SfDocumentEditor | baseComponent | An DocumentEdiorComponent instance. |
Properties
CellFormat
Gets the current instance of selection cell format.
Declaration
public SelectionCellFormatModule CellFormat { get; }
Property Value
| Type | Description |
|---|---|
| SelectionCellFormatModule | Returns SelectionCellFormatModule, refer SelectionCellFormatModule . |
CharacterFormat
Gets the current instance of selection character format.
Declaration
public SelectionCharacterFormatModule CharacterFormat { get; }
Property Value
| Type | Description |
|---|---|
| SelectionCharacterFormatModule | Returns SelectionCharacterFormatModule, refer SelectionCharacterFormatModule. |
DocumentEditor
DocumentEdiorComponent instance.
Declaration
protected SfDocumentEditor DocumentEditor { get; set; }
Property Value
| Type |
|---|
| SfDocumentEditor |
ImageFormat
Gets the instance of selection image format.
Declaration
public SelectionImageFormatModule ImageFormat { get; }
Property Value
| Type | Description |
|---|---|
| SelectionImageFormatModule | Returns SelectionImageFormatModule, refer SelectionImageFormatModule. |
ParagraphFormat
Gets the instance of selection paragraph format.
Declaration
public SelectionParagraphFormatModule ParagraphFormat { get; }
Property Value
| Type | Description |
|---|---|
| SelectionParagraphFormatModule | Returns SelectionParagraphFormatModule, refer SelectionParagraphFormatModule. |
RowFormat
Gets the instance of selection row format.
Declaration
public SelectionRowFormatModule RowFormat { get; }
Property Value
| Type |
|---|
| SelectionRowFormatModule |
SectionFormat
Gets the instance of selection section format.
Declaration
public SelectionSectionFormatModule SectionFormat { get; }
Property Value
| Type | Description |
|---|---|
| SelectionSectionFormatModule | Returns SelectionSectionFormatModule, refer SelectionSectionFormatModule. |
TableFormat
Gets the instance of selection table format.
Declaration
public SelectionTableFormatModule TableFormat { get; }
Property Value
| Type | Description |
|---|---|
| SelectionTableFormatModule | Returns SelectionTableFormatModule, refer SelectionTableFormatModule. |
Methods
CheckSelectionIsAtEditRegionAsync()
Check if selection is in edit region.
Declaration
public Task<bool> CheckSelectionIsAtEditRegionAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> | Returns an asynchronous operation. |
CloseHeaderFooterAsync()
Closes the header and footer region.
Declaration
public Task CloseHeaderFooterAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
CopyAsync()
Copies the selected content to clipboard.
Declaration
public Task CopyAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
CopyHyperlinkAsync()
Copies the hyperlink URL if the context is within hyperlink.
Declaration
public Task CopyHyperlinkAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendBackwardAsync()
Extends selection backward.
Declaration
public Task ExtendBackwardAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendForwardAsync()
Extends selection forward.
Declaration
public Task ExtendForwardAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToLineEndAsync()
Extend selection from current position to end of line.
Declaration
public Task ExtendToLineEndAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToLineStartAsync()
Extend selection from current position to start of line.
Declaration
public Task ExtendToLineStartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToNextLineAsync()
Extend selection from current position to next line.
Declaration
public Task ExtendToNextLineAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToParagraphEndAsync()
Extend selection from selection from current position to paragraph end.
Declaration
public Task ExtendToParagraphEndAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToParagraphStartAsync()
Extends selection from current position to paragraph start.
Declaration
public Task ExtendToParagraphStartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToPreviousLineAsync()
Extends selection from current position to previous line.
Declaration
public Task ExtendToPreviousLineAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToWordEndAsync()
Extends selection to word end.
Declaration
public Task ExtendToWordEndAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ExtendToWordStartAsync()
Extends selection to word start.
Declaration
public Task ExtendToWordStartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
GetBookmarksAsync()
Gets bookmark name collection.
Declaration
public Task<List<string>> GetBookmarksAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.List<System.String>> | Returns an asynchronous operation. |
GetBookmarksAsync(Boolean)
Gets the bookmark name collection in current selection.
Declaration
public Task<List<string>> GetBookmarksAsync(bool includeHidden = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | includeHidden | Include hidden bookmarks. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.List<System.String>> | Returns an asynchronous operation of list of string. |
GetContextTypeAsync()
Gets the context type of the selection.
Declaration
public Task<ContextType> GetContextTypeAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ContextType> | Returns an asynchronous operation of ContextType, refer ContextType. |
GetEndOffsetAsync()
Asynchronously retrieves the ending hierarchical offset of the current text selection within the document editor.
Declaration
public Task<string> GetEndOffsetAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.String> | The task result contains a string representing the ending hierarchical offset of the selection. |
GetEndPageAsync()
Gets the page number where the selection ends.
Declaration
public Task<int> GetEndPageAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Int32> | Returns an asynchronous operation. |
GetFieldInfoAsync()
Gets the field information for the selected field.
Declaration
public Task<FieldInfo> GetFieldInfoAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<FieldInfo> | Return refer FieldInfo if selection is in field, otherwise |
Remarks
Returns null for text, image, table, shape. For nested fields, it returns combined field code and result.
GetScrollPositionAsync()
Gets the current scroll position of the document editor.
Declaration
public Task<ScrollPosition> GetScrollPositionAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ScrollPosition> | An object containing the current scroll position. |
GetSfdtAsync()
Gets the selected content of the document as SFDT (Syncfusion Document Text) file format.
Declaration
public Task<string> GetSfdtAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.String> | Returns an asynchronous operation of string type that represents the SFDT (Syncfusion Document Text) file format. If no content is selected, then it returns null. |
Examples
The following code example demonstrates how to retrieve the selected content of the document as SFDT and paste the same in the document editor.
// Gets the selected content of the document as SFDT and paste the same in the document editor.
SfDocumentEditorContainer container;
await string sfdt = container.DocumentEditor.Selection.GetSfdtAsync();
await container.DocumentEditor.Editor.PasteAsync(sfdt);
GetStartOffsetAsync()
Asynchronously retrieves the starting hierarchical offset of the current text selection within the document editor.
Declaration
public Task<string> GetStartOffsetAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.String> | The task result contains a string representing the starting hierarchical offset of the selection. |
GetStartPageAsync()
Gets the page number where the selection ends.
Declaration
public Task<int> GetStartPageAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Int32> | Returns an asynchronous operation. |
GetTextAsync()
Gets the text within selection.
Declaration
public Task<string> GetTextAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.String> | Returns an asynchronous operation of string type. |
GoToFooterAsync()
Moves the selection to the footer of current page.
Declaration
public Task GoToFooterAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
GoToHeaderAsync()
Moves the selection to the header of current page.
Declaration
public Task GoToHeaderAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
GoToPageAsync(Double)
Moves the selection to the start of specified page number.
Declaration
public Task GoToPageAsync(double pageNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | pageNumber | Page number to move. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
IsSelectionInsideFieldAsync()
Returns true if selection is in field.
Declaration
public Task<bool> IsSelectionInsideFieldAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> | Returns an asynchronous operation. |
MoveToDocumentEndAsync()
Moves selection to end of the document.
Declaration
public Task MoveToDocumentEndAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToDocumentStartAsync()
Moves selection to start of the document.
Declaration
public Task MoveToDocumentStartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToLineEndAsync()
Moves selection to end of the current line.
Declaration
public Task MoveToLineEndAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToLineStartAsync()
Moves selection to start of the current line.
Declaration
public Task MoveToLineStartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToNextCharacterAsync()
Moves selection to next character.
Declaration
public Task MoveToNextCharacterAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToNextLineAsync()
Moves selection to next line.
Declaration
public Task MoveToNextLineAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToParagraphEndAsync()
Moves selection to current paragraph end.
Declaration
public Task MoveToParagraphEndAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToParagraphStartAsync()
Moves selection to current paragraph start.
Declaration
public Task MoveToParagraphStartAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToPreviousCharacterAsync()
Moves selection to previous character.
Declaration
public Task MoveToPreviousCharacterAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
MoveToPreviousLineAsync()
Moves selection to previous line.
Declaration
public Task MoveToPreviousLineAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
NavigateHyperlinkAsync()
Fires the RequestNavigateEventArgs event if current selection context is in hyperlink.
Declaration
public Task NavigateHyperlinkAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
NavigateNextCommentAsync()
Navigate to next comment in the document.
Declaration
public Task NavigateNextCommentAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
NavigateNextRevisionAsync()
Navigate to next revision in the document.
Declaration
public Task NavigateNextRevisionAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
NavigatePreviousCommentAsync()
Navigate to previous comment in the document.
Declaration
public Task NavigatePreviousCommentAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
NavigatePreviousRevisionAsync()
Navigate to previous revision in the document.
Declaration
public Task NavigatePreviousRevisionAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous operation. |
NavigateToNextEditingRegionAsync()
Navigate to next editing region, where current user can edit.
Declaration
public Task NavigateToNextEditingRegionAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
NextEndnoteAsync()
Navigate to next Endnote from current selection.
Declaration
public Task NextEndnoteAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
NextFootnoteAsync()
Navigate to next footnote from current selection.
Declaration
public Task NextFootnoteAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
PreviousEndnoteAsync()
Navigate to previous Endnote from current selection.
Declaration
public Task PreviousEndnoteAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
PreviousFootnoteAsync()
Navigate to previous footnote from current selection.
Declaration
public Task PreviousFootnoteAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectAllAsync()
Selects the entire document.
Declaration
public Task SelectAllAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectAsync(SelectionSettings)
Selects content based on selection settings.
Declaration
public Task SelectAsync(SelectionSettings selectionSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| SelectionSettings | selectionSettings | Selection settings refer SelectionSettings. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectAsync(String, String)
Selects the content based on the specified start and end hierarchical index.
Declaration
public Task SelectAsync(string startOffset, string endOffset)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | startOffset | Specify the start hierarchical index. |
| System.String | endOffset | Specify the end hierarchical index. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectBookmarkAsync(String)
Selects the specified bookmark.
Declaration
public Task SelectBookmarkAsync(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Bookmark name to select. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectBookmarkAsync(String, Boolean)
Selects the specified bookmark.
Declaration
public Task SelectBookmarkAsync(string name, bool excludeBookmarkStartEnd)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | Specify the bookmark name to select. |
| System.Boolean | excludeBookmarkStartEnd | Specify true to exclude bookmark start and end from selection, otherwise false. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectByHierarchicalIndexAsync(String, String)
Selects based on start and end hierarchical index.
Declaration
public Task SelectByHierarchicalIndexAsync(string start, string end)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | start | Start index. |
| System.String | end | End index. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectCellAsync()
Selects the entire cell if the context is within table.
Declaration
public Task SelectCellAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectColumnAsync()
Selects the entire column if the context is within table.
Declaration
public Task SelectColumnAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectCurrentWordAsync(Boolean)
Selects Current word.
Declaration
public Task SelectCurrentWordAsync(bool excludeSpace = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | excludeSpace | Exclude space while selecting. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectFieldAsync()
Select the current field if selection is in field.
Declaration
public Task SelectFieldAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectLineAsync()
Selects current line.
Declaration
public Task SelectLineAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectParagraphAsync()
Selects current paragraph.
Declaration
public Task SelectParagraphAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectRowAsync()
Selects the entire row if the context is within table.
Declaration
public Task SelectRowAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SelectTableAsync()
Selects the entire table if the context is within table.
Declaration
public Task SelectTableAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
SetScrollPositionAsync(ScrollPosition)
Sets the scroll position of the document editor.
Declaration
public Task SetScrollPositionAsync(ScrollPosition Position)
Parameters
| Type | Name | Description |
|---|---|---|
| ScrollPosition | Position | The target scroll position |
Returns
| Type |
|---|
| System.Threading.Tasks.Task |
ShowAllEditingRegionAsync()
Shows all the editing region, where current user can edit.
Declaration
public Task ShowAllEditingRegionAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |
ToggleEditingRegionHighlightAsync()
Highlight all the editing region, where current user can edit.
Declaration
public Task ToggleEditingRegionHighlightAsync()
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | Returns an asynchronous operation. |