Represents an interface with APIs for editing office files
Members
-
<static> EditingStreamType
-
An enum representing the active editing stream in Office Editor.
Properties:
Name Type Description BODYstring body stream HEADERstring header stream FOOTERstring footer stream -
<static> EditMode
-
An enum representing the available edit modes in Office Editor.
Properties:
Name Type Description EDITINGstring normal editing mode REVIEWINGstring review mode. Any edits create track changes. VIEW_ONLYstring Read only mode. No editing is available. PREVIEWstring Read only mode. No editing is available and all track changes are previewed as accepted. -
<static> ListStylePresets
-
An enum representing different list indent Style
Properties:
Name Type Description BULLETstring "●", "●", "●" BULLET_SQUAREstring "●", "●", "■" SQUARE_BULLETstring "■", "●", "●" DIAMONDstring "❖", "●", "○" CHECKstring "✔", "●", "○" ARROWstring "⇨", "●", "○" NUMBER_LATIN_ROMAN_1string "1.", "a.", "i." NUMBER_DECIMALstring "1.", "1.1", "1.1.1" NUMBER_LATIN_ROMAN_2string "1)", "a)", "i)" LATIN_ROMANstring "A.", "a.", i." ROMAN_LATIN_NUMBERstring "I.", "A.", "1." -
<static> ToggleableStyles
-
An enum representing the toggleable text styles in Office Editor.
Properties:
Name Type Description BOLDstring 'bold' ITALICstring 'italic' UNDERLINEstring 'underline'
Methods
-
acceptTrackedChange(id)
-
Accepts a tracked change in Office Editor Document.
Parameters:
Name Type Description idnumber The id of the tracked change to accept Returns:
- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.acceptTrackedChange(id);
-
copySelectedText()
-
Copy the current selected text to clipboard.
Returns:
Returns a promise that resolves when the action finishes.- Type
- Promise.<void>
-
decreaseIndent()
-
Decrease the indent of the current paragraphs.
Returns:
- Type
- Promise.<void>
-
focusContent()
-
Focus on the currently opened document content
-
getEditingPageNumber()
-
Get the page number of the page that is currently being edited.
Returns:
Returns a promise that resolves to the page number of the page that is currently being edited.- Type
- Promise.<number>
-
getMaxHeaderFooterDistance(pageNumber)
-
Get the maximum header and footer margin distance (1/3 of the page's height) in inches for the page at the cursor's location.
Parameters:
Name Type Description pageNumbernumber The target page number. Returns:
Returns a promise that resolves the maximum header and footer margin distance in inches.- Type
- Promise.<number>
-
getSectionColumns( [unit])
-
Get the number of columns in the current section of the cursor's location.
Parameters:
Name Type Argument Default Description unit'inch' | 'cm' | 'mm' <optional>
'inch' The unit of the widths and spacing. Returns:
Returns a promise that resolves to an array of column widths in the specified unit. The array will have an odd length, where odd indices are column widths and even indices are spacing widths.- Type
- Promise.<Array.<number>>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.getSectionColumns();
-
getSectionMargins( [unit])
-
Get the section margins of the current section of the cursor's location.
Parameters:
Name Type Argument Default Description unit'inch' | 'cm' | 'mm' <optional>
'inch' The unit of margins. Returns:
Returns a promise that resolves to an object containing the section margins in the specified unit.- Type
- Promise.<any>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.getSectionMargins();
-
getTrackedChanges()
-
Returns an array of tracked change objects after documentComplete is resolved.
Returns:
trackedChanges The tracked changes in the document- Type
- Promise.<Array.<Core.Document.OfficeEditor.TrackedChange>>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); let trackedChanges = await officeEditor.getTrackedChanges(); instance.Core.documentViewer.getDocument().addEventListener('trackedChangesUpdated', async () => { trackedChanges = await officeEditor.getTrackedChanges(); }); -
increaseIndent()
-
Increase the indent of the current paragraphs.
Returns:
- Type
- Promise.<void>
-
isTextSelected()
-
Returns whether text is being selected.
Returns:
- Type
- boolean
-
pasteText(withFormatting)
-
Paste text from clipboard.
Parameters:
Name Type Description withFormattingboolean Whether to paste with formatting or not. -
rejectTrackedChange(id)
-
Rejects a tracked change in Office Editor Document.
Parameters:
Name Type Description idnumber The id of the tracked change to reject Returns:
- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.rejectTrackedChange(id);
-
removeFooters(pageNumber)
-
Remove footers from the first section of the target page. For that section, only footers that are of the same type as the target page will be removed.
Parameters:
Name Type Description pageNumbernumber The page number of the target page. Returns:
- Type
- Promise.<void>
-
removeHeaders(pageNumber)
-
Remove headers from the first section of the target page. For that section, only headers that are of the same type as the target page will be removed.
Parameters:
Name Type Description pageNumbernumber The page number of the target page. Returns:
- Type
- Promise.<void>
-
removeSelection()
-
Remove the current selected text.
-
setCustomSectionColumns( [widthsAndSpacing] [, unit])
-
Set the number of columns and spacing for the current section, based on the cursor's location, using an array of widths and spacing.
Parameters:
Name Type Argument Default Description widthsAndSpacingArray.<number> <optional>
An array with odd length containing the unit values where odd indices are column widths and even indices are spacing widths. unit'inch' | 'cm' | 'mm' <optional>
'inch' The unit of the widths and spacing. Returns:
- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.setCustomSectionColumns([4, 0.5, 2], 'inch');
-
setEditMode(editMode)
-
Sets the current edit mode.
Parameters:
Name Type Description editModeCore.Document.OfficeEditor.EditMode The new edit mode Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); officeEditor.setEditMode(instance.Core.Document.OfficeEditor.EditMode.REVIEWING);
-
setEqualSectionColumns( [numberOfColumns])
-
Set the number of columns and spacing with even widths in the current section of the cursor's location. The spacing is 0.5 inches (1.27 cm)
Parameters:
Name Type Argument Description numberOfColumnsnumber <optional>
The number of columns to set in the section. Returns:
- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.setEqualSectionColumns(3);
-
setListPreset(listStyleEnum)
-
Set the indent style of the selected text
Parameters:
Name Type Description listStyleEnumCore.Document.OfficeEditor.ListStylePresets The style preset to set list to Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); officeEditor.setListPreset(instance.Core.Document.OfficeEditor.ListStylePresets.DIAMOND);
-
setMainCursorStyle(style)
-
Set the style of the cursor.
Parameters:
Name Type Description styleCore.Document.OfficeEditor.CursorStyle The style object Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); officeEditor.setMainCursorStyle({ pointSize: 24, italic: false, bold: false}); -
toggleListSelection(listType)
-
Toggle the list selection.
Parameters:
Name Type Description listType'ordered' | 'unordered' The type of the list. Returns:
Returns a promise that resolves when the action finishes.- Type
- Promise.<void>
-
toggleSelectedTextStyle(style)
-
Toggle style of the selected text.
Parameters:
Name Type Description styleCore.Document.OfficeEditor.ToggleableStyles The style to toggle Returns:
Returns a promise that resolves when the style has been toggled- Type
- Promise.<void>
-
updateParagraphStyle(style)
-
Updates the style of the current paragraph.
Parameters:
Name Type Description styleCore.Document.OfficeEditor.ParagraphStyle The styles to apply. Returns:
Returns a promise that resolves when the action finishes.- Type
- Promise.<void>
-
updateSearchData()
-
Update the search data. Should be called whenever a search is performed to make sure all text data has been downloaded for the document.
-
updateSelectionStyle(style)
-
Update the style of the current selection.
Parameters:
Name Type Description styleCore.Document.OfficeEditor.SelectionStyle The styles to apply. Returns:
Returns a promise that resolves when the action finishes.- Type
- Promise.<void>
Type Definitions
-
CursorStyle
-
Type:
- Object
Properties:
Name Type Argument Description paragraphPropertiesobject <optional>
The properties of the paragraph -
ParagraphStyle
-
Type:
- Object
Properties:
Name Type Argument Description paragraphTextStyleCore.Document.OfficeEditor.TextStyle <optional>
The text style of the paragraph. justificationObject <optional>
The justification of the paragraph. lineHeightMultipliernumber <optional>
The line height multiplier of the paragraph. -
SelectionStyle
-
Type:
- Object
Properties:
Name Type Argument Description paragraphPropertiesobject <optional>
The properties of the paragraph -
TextStyle
-
Type:
- Object
Properties:
Name Type Argument Description boldboolean <optional>
Whether the selected text should be bold italicboolean <optional>
Whether the selected text should be italic underlineboolean <optional>
Whether the selected text should have underline fontFacestring <optional>
The font face of the text pointSizenumber <optional>
The point size of the text colorobject <optional>
The font color of the text, e.g. { r: 255, g: 0, b: 0, a: 255 } -
TrackedChange
-
Type:
- Object
Properties:
Name Type Argument Description idnumber <optional>
The id of the tracked change type'inserted' | 'deleted' <optional>
The type of the tracked change authorstring <optional>
The author of the tracked change dateDate <optional>
The date of the tracked change plaintextstring <optional>
The content of the tracked change to be inserted or deleted
Events
-
cursorPropertiesUpdated
-
Triggered only in an Office Editor Document. Triggered when the main cursor properties are updated.
Parameters:
Name Type Description cursorPropertiesCore.Document.OfficeEditor.CursorStyle The cursor properties. -
officeDocumentEdited
-
Triggered only in an Office Editor Document. Triggered when the document has been edited.
-
selectionPropertiesUpdated
-
Triggered only in an Office Editor Document. Triggered when the text selection properties are updated.
Parameters:
Name Type Description selectionPropertiesCore.Document.OfficeEditor.SelectionStyle The selection properties. -
trackedChangesUpdated
-
Triggered only in an Office Editor document whenever a tracked change is added, removed, or modified.