Editor
12 Sep 202522 minutes to read
Editor module
Methods
applyBorders
Applies the borders based on given settings.
| Parameter | Type | Description |
|---|---|---|
| settings | BorderSettings |
Specify the border settings to be applied. |
Returns void
applyBullet
Applies the bullet list to selected paragraphs.
| Parameter | Type | Description |
|---|---|---|
| bullet | string |
Specify the bullet character to be applied. |
| fontFamily | string |
Specify the bullet font family name. |
Returns void
applyContinueNumbering
Applies the continue numbering from the previous list.
Returns void
applyNumbering
Applies the numbering list to selected paragraphs.
| Parameter | Type | Description |
|---|---|---|
| numberFormat | string |
“%n” representations in ‘numberFormat’ parameter will be replaced by respective list level’s value.“%1)” will be displayed as “1)”
|
| listLevelPattern (optional) | ListLevelPattern |
Default value of ‘listLevelPattern’ parameter is ListLevelPattern.Arabic |
Returns void
applyStyle
Applies the specified style for paragraph.
| Parameter | Type | Description |
|---|---|---|
| style | string |
Specify the style name to apply. |
| clearDirectFormatting (optional) | boolean |
Removes manual formatting (formatting not applied using a style) from the selected text, to match the formatting of the applied style. Default value is false. |
Returns void
autoFitTable
Fits the table based on AutoFitType.
| Parameter | Type | Description |
|---|---|---|
| fitType | AutoFitType |
Specify the auto fit type. |
Returns void
beginBatchEdit
Initiates a batch update mode where multiple editing operations can be grouped together. This prevents intermediate re-layout during the execution of grouped operations, improving performance for bulk updates.
Returns void
canMergeCells
Determines whether the merge cell operation can be done.
Returns boolean
clearElementRevision
Clears the specified revision from the document.
| Parameter | Type | Description |
|---|---|---|
| revision | Revision |
Specify the revision to clear from the document. |
Returns void
clearFormatting
Clears the formatting.
Returns void
clearList
Clears the list format for selected paragraphs.
Returns void
continueNumbering
Continues the numbering sequence of the current list from the selected paragraph.
Returns void
createStyle
Creates a new style or modifies an existing style with the specified style properties.
If modifyExistingStyle parameter is set to true and a style already exists with same name, it modifies the specified properties in the existing style.
If modifyExistingStyle parameter is set to false and a style already exists with same name, it creates a new style with unique name by appending ‘_1’. Hence, the newly style will not have the specified name.
If no style exists with same name, it creates a new style.
| Parameter | Type | Description |
|---|---|---|
| styleString | string |
The style properties. |
| modifyExistingStyle (optional) | boolean |
The Boolean value denotes whether to modify the properties in the existing style or create a new style. |
Returns string
cut
Moves the selected content in the document editor control to clipboard.
Returns void
decreaseIndent
Decreases the left indent of selected paragraphs to a factor of 36 points.
Returns void
delete
Removes the current selected content or one character right of the cursor.
Returns void
deleteAllComments
Deletes all the comments in the current document.
Returns void
deleteBookmark
Deletes the specified bookmark in the current document.
| Parameter | Type | Description |
|---|---|---|
| bookmarkName | string |
Specify the name of bookmark to be deleted. |
Returns void
deleteColumn
Deletes the selected column(s).
Returns void
deleteComment
Deletes the specified comment.
If the provided id corresponds to a parent comment, the entire comment along with its replies will be deleted.
If the provided id corresponds to a single reply comment, only that particular reply will be deleted.
Returns void
deleteRow
Deletes the selected row(s).
Returns void
deleteTable
Deletes the entire table at selection.
Returns void
endBatchEdit
Ends the batch update mode and triggers a single re-relayout or change notification to reflect all the modifications made during the batch update.
Returns void
enforceProtection
Enforces the document protection by protection type.
| Parameter | Type | Description |
|---|---|---|
| credential | string |
Specify the credential to protect the document. |
| protectionType | ProtectionType |
Specify the document protection type. |
Returns void
enforceProtection
Enforces the document protection with the specified credential.
| Parameter | Type | Description |
|---|---|---|
| credential | string |
Specify the credential to protect the document. |
| limitToFormatting | boolean |
True if to limit the document formatting; Otherwise, false. |
| isReadOnly | boolean |
True if to allow read-only access to the document; Otherwise, false. |
Returns void
enforceProtectionAsync
Enforces the document protection with the specified protection type.
| Parameter | Type | Description |
|---|---|---|
| credential | string |
Specify the credential to protect the document. |
| protectionType | ProtectionType |
Specify the document protection type. |
Returns Promise
enforceProtectionAsync
Enforces the document protection with the specified credential.
| Parameter | Type | Description |
|---|---|---|
| credential | string |
Specify the credential to protect the document. |
| limitToFormatting | boolean |
True if to limit the document formatting; Otherwise, false. |
| isReadOnly | boolean |
True if to allow read-only access to the document; Otherwise, false. |
Returns Promise
increaseIndent
Increases the left indent of selected paragraphs to a factor of 36 points.
Returns void
insertBookmark
Inserts the specified bookmark at the current selection range.
Returns void
insertColumn
Inserts the specified number of columns to the table left or right to the column at cursor position.
| Parameter | Type | Description |
|---|---|---|
| left (optional) | boolean |
The left parameter is optional and if omitted, it takes the value as false and inserts to the right of column at cursor position. |
| count (optional) | number |
The count parameter is optional and if omitted, it takes the value as 1. |
Returns void
insertColumnBreak
Inserts a column break at cursor position.
Returns void
insertComment
Inserts the comment.
| Parameter | Type | Description |
|---|---|---|
| text (optional) | string |
Specify the comment text to be inserted. |
Returns void
insertComment
Inserts a comment with the specified properties.
| Parameter | Type | Description |
|---|---|---|
| text | string |
Specify the comment text to be inserted. |
| commentProperties | CommentProperties |
The properties of the comment (author, isResolved, dateTime). |
Returns Comment
insertContentControl
Inserts a content control.
Returns ContentControlInfo
insertContentControl
Inserts a content control.
Returns ContentControlInfo
insertContentControl
Inserts a content control.
Returns ContentControlInfo
insertContentControl
Inserts a content control with the specified content control properties.
| Parameter | Type | Description |
|---|---|---|
| info | ContentControlInfo |
The content control information specifying the properties of the content control to insert |
Returns ContentControlInfo
insertEditingRegion
Inserts the editing region where everyone can edit.
Returns void
insertEditingRegion
Inserts the editing region where mentioned user can edit.
| Parameter | Type | Description |
|---|---|---|
| user | string |
Specifies the native rendering |
Returns void
insertEndnote
Inserts the endnote at the current selection
Returns void
insertField
Inserts the specified field at cursor position.
| Parameter | Type | Description |
|---|---|---|
| code | string |
Specify the field code. |
| result (optional) | string |
Specify the field result. |
Returns void
insertFootnote
Inserts the footnote at the current selection.
Returns void
insertFormField
Inserts the specified form field at the current selection.
| Parameter | Type | Description |
|---|---|---|
| type | FormFieldType |
Specify the Form field type to insert. |
Returns void
insertHyperlink
Inserts the Hyperlink.
| Parameter | Type | Description |
|---|---|---|
| address | string |
Specify the Hyperlink URL to be inserted. |
| displayText (optional) | string |
Specify the display text for the hyperlink |
| screenTip (optional) | string |
Specify the screen tip text. |
Returns void
insertImage
Inserts the image with specified size at cursor position in the document editor.
| Parameter | Type | Description |
|---|---|---|
| imageString | string |
Base64 string, web URL or file URL. |
| width (optional) | number |
Specify the image width. |
| height (optional) | number |
Specify the image height. |
| alternateText (optional) | string |
Specify the image alternateText. |
Returns void
insertImageAsync
Inserts an image with a specified size at the cursor position in the DocumentEditor component.
| Parameter | Type | Description |
|---|---|---|
| imageString | string |
The Base64 string, web URL, or file URL of the image to be inserted. |
| width (optional) | number |
The width of the image. Optional parameter, if not specified, the original width of the image will be used. |
| height (optional) | number |
The height of the image. Optional parameter, if not specified, the original height of the image will be used. |
| alternateText (optional) | string |
The alternate text of the image. Optional parameter, if specified, this text will be displayed when the image is not available or when images are disabled in the document. |
Returns Promise
insertPageBreak
Inserts the page break at the cursor position.
Returns void
insertPageNumber
Inserts the page number in the current cursor position.
| Parameter | Type | Description |
|---|---|---|
| numberFormat (optional) | string |
Optional switch that overrides the numeral style of the page number. |
Returns void
insertReplyComment
Inserts a reply to a comment.
| Parameter | Type | Description |
|---|---|---|
| id | string |
The unique identifier of the comment to reply to. |
| text | string |
The text of the reply. |
| commentProperties | CommentProperties |
The properties of the reply (author, isResolved, dateTime). |
Returns Comment
insertRow
Inserts the specified number of rows to the table above or below to the row at cursor position.
| Parameter | Type | Description |
|---|---|---|
| above (optional) | boolean |
The above parameter is optional and if omitted, it takes the value as false and inserts below the row at cursor position. |
| count (optional) | number |
The count parameter is optional and if omitted, it takes the value as 1. |
Returns void
insertSectionBreak
Inserts the section break at cursor position with specified section break type.
Returns void
insertTable
Inserts a table of specified size at cursor position in the document editor.
| Parameter | Type | Description |
|---|---|---|
| rows (optional) | number |
Default value of ‘rows’ parameter is 1. |
| columns (optional) | number |
Default value of ‘columns’ parameter is 1. |
Returns void
insertTableOfContents
Inserts, modifies or updates the table of contents based on given settings.
| Parameter | Type | Description |
|---|---|---|
| tableOfContentsSettings (optional) | TableOfContentsSettings |
Specify the table of content settings to be inserted. |
Returns void
insertText
Inserts the specified text at cursor position
| Parameter | Type | Description |
|---|---|---|
| text | string |
Specify the text to insert. |
Returns void
mergeCells
Merges the selected cells.
Returns void
paste
Pastes the provided content into the editor.
Returns void
paste
Pastes the provided sfdt content or the data present in local clipboard if any.
| Parameter | Type | Description |
|---|---|---|
| sfdt (optional) | string |
Specifies the sfdt content to paste at current position. |
| defaultPasteOption (optional) | PasteOptions |
Specifies the paste options. |
Returns void
removeEditingRegion
Removes the editing permission range at the current selection position that matches the specified username.
If user is provided, removes the editing region specific to that user.
If user is not provided (null or undefined), it defaults to ‘Everyone’.
Returns void
removeEmptyParagraph
Removes an empty paragraph from in the current selection position.
This method handles the removal of empty paragraphs by determining the appropriate deletion strategy based on the paragraph’s context.
Only operates when both the paragraph and current selection are empty.
Returns void
removeHyperlink
Removes the hyperlink if selection is within hyperlink.
Returns void
removeRevision
Removes the specified revision from the document.
| Parameter | Type | Description |
|---|---|---|
| revisionToRemove | Revision |
Specify the revision to be removed. |
Returns any
restartNumbering
Restarts the numbering of the current list from the selected paragraph.
Returns void
retrieveFieldResultantText
Retrieves the resultant field text from the specified field element box.
| Parameter | Type | Description |
|---|---|---|
| item | FieldElementBox |
Specify the field element box to retrieve field text. |
Returns string
setContentControlInfo
Sets the existing content control within the editor using the provided information.
The content control is identified by its unique combination of title and tag.
Returns ContentControlInfo
setFieldInfo
Sets the field information for the selected field.
| Parameter | Type | Description |
|---|---|---|
| fieldInfo | FieldInfo |
– Specifies the field information. |
Returns void
stopProtection
Stops the document protection.
| Parameter | Type | Description |
|---|---|---|
| password | string |
Specify the password to stop protection. |
Returns void
stopProtectionAsync
Stops the document protection.
| Parameter | Type | Description |
|---|---|---|
| password | string |
Specify the password to stop protection. |
Returns Promise
toggleAllCaps
Toggles the all Caps formatting for the selected content.
Returns void
toggleBaselineAlignment
Toggles the baseline alignment property of selected contents.
| Parameter | Type | Description |
|---|---|---|
| baseAlignment | BaselineAlignment |
Specifies the baseline alignment. |
Returns void
toggleBold
Toggles the bold property of selected contents.
Returns void
toggleHighlightColor
Toggles the highlight color property of selected contents.
| Parameter | Type | Description |
|---|---|---|
| highlightColor (optional) | HighlightColor |
Specify the highlight color to be applied (default: Yellow). |
Returns void
toggleItalic
Toggles the bold property of selected contents.
Returns void
toggleStrikethrough
Toggles the strike through property of selected contents.
| Parameter | Type | Description |
|---|---|---|
| strikethrough (optional) | Strikethrough |
Specify the strike through to be toggled (default: SingleStrike). |
Returns void
toggleSubscript
Toggles the subscript formatting of selected contents.
Returns void
toggleSuperscript
Toggles the superscript formatting of selected contents.
Returns void
toggleTextAlignment
Toggles the text alignment of selected paragraphs.
| Parameter | Type | Description |
|---|---|---|
| textAlignment | TextAlignment |
Specifies the text alignment. |
Returns void
toggleUnderline
Toggles the underline property of selected contents.
| Parameter | Type | Description |
|---|---|---|
| underline (optional) | Underline |
Specify the underline to be toggled (default: Single). |
Returns void
updateSelectedCellsInTable
private
Returns CellInfo