Selection
12 Sep 202510 minutes to read
Selection
Properties
bookmarks string[]
Gets bookmark name collection.
cellFormat SelectionCellFormat
Gets the instance of selection cell format.
characterFormat SelectionCharacterFormat
Gets the instance of selection character format.
contextType ContextType
Gets the context type of the selection.
endOffset string
Returns the end hierarchical index.
endPage number
Gets the page number where the selection ends.
fields FieldStartInfo[]
Gets the list of fields present within the current selection in the document. This property can be used to identify and work with field elements present in the selected text range.
imageFormat SelectionImageFormat
Gets the instance of selection image format.
isInField boolean
Returns true if selection is in field.
paragraphFormat SelectionParagraphFormat
Gets the instance of selection paragraph format.
rowFormat SelectionRowFormat
Gets the instance of selection row format.
sectionFormat SelectionSectionFormat
Gets the instance of selection section format.
sfdt string
Gets the selected content of the document as SFDT(Syncfusion Document Text) file format.
startOffset string
Returns the start hierarchical index.
startPage number
Gets the page number where the selection starts.
tableFormat SelectionTableFormat
Gets the instance of selection table format.
text string
Gets the text within selection.
Methods
checkSelectionIsAtEditRegion
Determines whether the specified start and end position of the selection is inside the edit region.
| Parameter | Type | Description |
|---|---|---|
| start (optional) | TextPosition |
Specify the start position of the selection. |
| end (optional) | TextPosition |
Specify the end position of the selection. |
Returns boolean
closeHeaderFooter
Closes the header and footer region.
Returns void
closeXmlPane
Closes the xml Pane region.
Returns void
copy
Copies the selected content to clipboard.
Returns void
copyHyperlink
Copies the hyperlink URL if the context is within hyperlink.
Returns void
extendBackward
Extends the selection backward.
Returns void
extendForward
Extends the selection forward.
Returns void
extendToLineEnd
Extends the selection to line end
Returns void
extendToLineStart
Extends the selection to line start.
Returns void
extendToNextLine
Extends the selection to next line.
Returns void
extendToParagraphEnd
Extends the selection to the paragraph end.
Returns void
extendToParagraphStart
Extends the selection to the paragraph start.
Returns void
extendToPreviousLine
Extends the selection to previous line.
Returns void
extendToWordEnd
Extends the selection to word end.
Returns void
extendToWordEndInternal
Extends the selection to word end.
Returns void
extendToWordStart
Extends the selection to word start.
Returns void
getBookmarks
Gets the bookmark name collection in current selection.
| Parameter | Type | Description |
|---|---|---|
| includeHidden (optional) | boolean |
Decide whether to include hidden bookmark name in current selection or not. |
Returns string[]
getCellsToSelect
Returns the cells in between the bounds.
| Parameter | Type | Description |
|---|---|---|
| table | TableWidget |
Specify the table to find cells. |
| columnFirst | number |
Specify start index of column to find cells. |
| columnLast | number |
Specify end index of column to find cells. |
| bookmark | BookmarkElementBox |
Specify the bookmark element. |
Returns TableCellWidget[]
getContentControlInfo
Retrieves the information about the content control associated with the current selection.
Returns ContentControlInfo
getContextBasedPasteOptions
Returns an array of context-based paste options.
Returns string[]
getFieldInfo
Gets the field information for the selected field.
Returns FieldInfo
getNextContextType
Gets the context type of next character or element.
| Parameter | Type | Description |
|---|---|---|
| isElement (optional) | boolean |
Decides whether to get next context type from element or character. By default, character. |
Returns string
getPreviousContextType
Gets the context type of previous character or element.
| Parameter | Type | Description |
|---|---|---|
| isElement (optional) | boolean |
Decides whether to get previous context type from element or character. By default, character. |
Returns string
getScrollPosition
Gets the current scroll position of the document editor.
Returns ScrollPosition
goToFooter
Moves the selection to the footer of current page.
Returns void
goToHeader
Moves the selection to the header of current page.
Returns void
goToPage
Moves the selection to the start of specified page number.
| Parameter | Type | Description |
|---|---|---|
| pageNumber | number |
Specify the page number to move selection. |
Returns void
isSelectionInEditRegion
Determines whether the selection is inside the edit region.
Returns boolean
isSelectionInField
Determines whether the current selection is within a field.
| Parameter | Type | Description |
|---|---|---|
| includeFieldStart | boolean |
Optional. If true, includes the field start in the selection check. Default is false. |
| includeFieldEnd | boolean |
Optional. If true, includes the field end in the selection check. Default is false. |
Returns boolean
moveToDocumentEnd
Moves the selection to the end of the document.
Returns void
moveToDocumentStart
Moves the selection to the start of the document.
Returns void
moveToLineEnd
Moves the selection to end of the current line.
Returns void
moveToLineStart
Moves the selection to start of the current line.
Returns void
moveToNextCharacter
Moves the selection to the next character.
Returns void
moveToNextLine
Moves the selection to the next line.
Returns void
moveToParagraphEnd
Moves the selection to the current paragraph end.
Returns void
moveToParagraphStart
Moves the selection to the current paragraph start.
Returns void
moveToPreviousCharacter
Moves the selection to the previous character.
Returns void
moveToPreviousLine
Moves the selection to the previous line.
Returns void
navigateHyperlink
Fires the requestNavigate event if current selection context is in hyperlink.
Returns void
navigateNextComment
Navigates to the next comment in the document.
Returns void
navigateNextRevision
Navigates to the next revision in the document.
Returns void
navigatePreviousComment
Navigates to the previous comment in the document.
Returns void
navigatePreviousRevision
Navigates to the previous revision in the document.
Returns void
navigateToNextEditingRegion
Navigates to the next editing region, where current user can edit.
Returns void
nextEndnote
Navigates to the next endnote from the current selection
Returns void
nextFootnote
Navigates to the next footnote from the current selection.
Returns void
previousEndnote
Navigates to the previous endnote from the current selection.
Returns void
previousFootnote
Navigates to the previous footnote from the current selection.
Returns void
select
Selects content based on selection settings
Returns void
select
Selects the content based on the specified start and end hierarchical index.
| Parameter | Type | Description |
|---|---|---|
| start | string |
Specify the start hierarchical index. |
| end | string |
Specify the end hierarchical index. |
Returns void
selectAll
Selects the entire document.
Returns void
selectBookmark
Selects the specified bookmark.
| Parameter | Type | Description |
|---|---|---|
| name | string |
Specify the bookmark name to select. |
| excludeBookmarkStartEnd (optional) | boolean |
Specify true to exclude bookmark start and end from selection, otherwise false. |
Returns void
selectBookmarkInTable
Selects the cells between bookmark start and end.
| Parameter | Type | Description |
|---|---|---|
| bookmark | BookmarkElementBox |
Specify the bookmark. |
Returns void
selectByHierarchicalIndex
Selects the content based on the specified start and end hierarchical index.
| Parameter | Type | Description |
|---|---|---|
| start | string |
Specify the start index to select. |
| end | string |
Specify the end index to select. |
Returns void
selectCell
Selects the entire cell if the context is within table.
Returns void
selectColumn
Selects the entire column if the context is within table.
Returns void
selectCurrentWord
Selects the current word.
| Parameter | Type | Description |
|---|---|---|
| excludeSpace (optional) | boolean |
True if exclude white space; Otherwise, false. |
Returns void
selectField
Selects the current field if selection is in field
| Parameter | Type | Description |
|---|---|---|
| fieldInfo (optional) | FieldElementBox |
Specify the field start to select. |
Returns void
selectField
Selects the field in the document using the provided fieldStart information. This method highlights the corresponding field and brings it into view within the editor.
| Parameter | Type | Description |
|---|---|---|
| fieldInfo (optional) | FieldStartInfo |
The information about the field to be selected. |
Returns void
selectLine
Selects the current line.
Returns void
selectParagraph
Selects the current paragraph.
Returns void
selectRow
Selects the entire row if the context is within table.
Returns void
selectTable
Selects the entire table if the context is within table.
Returns void
setScrollPosition
Sets the scroll position of the document editor.
| Parameter | Type | Description |
|---|---|---|
| position | ScrollPosition |
The target scroll position |
Returns void
showAllEditingRegion
Shows all the editing region, where current user can edit.
Returns void
toggleEditingRegionHighlight
Highlights all the editing region, where current user can edit.
Returns void