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> EditOperationSource
-
An enum representing the sources of edit operations in Office Editor.
Properties:
Name Type Description HEADER_FOOTERstring Edit operation originated from header or footer modification. REPLACEstring Edit operation originated from a replace action. -
<static> LayoutUnits
-
An enum representing the measurement layout units in Office Editor. These units are used for setting margins, column widths and spacings, and other layout dimensions.
Properties:
Name Type Description CMstring centimeters MMstring millimeters INCHstring inches PHYSICAL_POINTstring points (1/72 of an inch) -
<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 idstring 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>
-
cutSelectedText()
-
Cut the current selected text to clipboard (copy and remove).
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>
-
getHeaderFooterMargins(pageNumber [, unit])
-
Get the header and footer margins for a specific page.
Parameters:
Name Type Argument Default Description pageNumbernumber The page number to get the margins for. unitCore.Document.OfficeEditor.LayoutUnits <optional>
'inch' The unit for the margin values. Returns:
- Type
- Promise.<{headerDistanceToTop: number, footerDistanceToBottom: number}>
-
getMaxHeaderFooterDistance(pageNumber [, unit])
-
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 Argument Default Description pageNumbernumber The target page number. unitCore.Document.OfficeEditor.LayoutUnits <optional>
'inch' The unit of the maximum header and footer margin distance. Returns:
Returns a promise that resolves the maximum header and footer margin distance in inches.- Type
- Promise.<number>
-
getPageDimensions(pageNumber [, unit])
-
Gets the page dimensions (width and height) for a specific page.
Parameters:
Name Type Argument Default Description pageNumbernumber The page number to get the dimensions for. unitCore.Document.OfficeEditor.LayoutUnits <optional>
'inch' The unit for the dimension values. Returns:
Returns an object containing the page width and height in the specified unit.- Type
- Object
-
getSectionColumns( [unit])
-
Get the number of columns in the current section, based on the cursor's location.
Parameters:
Name Type Argument Default Description unitCore.Document.OfficeEditor.LayoutUnits <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, based on the cursor's location.
Parameters:
Name Type Argument Default Description unitCore.Document.OfficeEditor.LayoutUnits <optional>
'inch' The unit for the margin values. Returns:
Returns a promise that resolves to an object containing the section margins in the specified unit.- Type
- Promise.<{top: number, bottom: number, left: number, right: number}>
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>
-
insertPageBreak()
-
Insert a page break at the current cursor position.
Returns:
Returns a promise that resolves when the page break is inserted- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.insertPageBreak();
-
insertSectionBreakContinuous()
-
Insert a section break that starts the new section on the same page.
Returns:
Returns a promise that resolves when the section break is inserted- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.insertSectionBreakContinuous();
-
insertSectionBreakNextPage()
-
Insert a section break that starts the new section on the next page.
Returns:
Returns a promise that resolves when the section break is inserted- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.insertSectionBreakNextPage();
-
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. Returns:
Returns a promise that resolves when the action finishes.- Type
- Promise.<void>
-
redo()
-
Redoes the last undone action in the office editor.
Returns:
Returns a promise that resolves when the operation is complete- Type
- Promise.<void>
-
rejectTrackedChange(id)
-
Rejects a tracked change in Office Editor Document.
Parameters:
Name Type Description idstring 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.
Returns:
Returns a promise that resolves when the action finishes.- Type
- Promise.<void>
-
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> An array with odd length containing the unit values where odd indices are column widths and even indices are spacing widths. unitCore.Document.OfficeEditor.LayoutUnits <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(mode)
-
Sets the current edit mode.
Parameters:
Name Type Description modeCore.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 Description numberOfColumnsnumber 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);
-
setHeaderFooterMargins(pageNumber, margins [, unit])
-
Set the header and footer margins for a specific page.
Parameters:
Name Type Argument Default Description pageNumbernumber The page number to set the margins for. marginsObject An object containing the header and footer margin values. unitCore.Document.OfficeEditor.LayoutUnits <optional>
'inch' The unit for the margin values. Returns:
- Type
- Promise.<void>
-
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}); -
setSectionMargins(margins [, unit])
-
Set the section margins of the current section, based on the cursor's location.
Parameters:
Name Type Argument Default Description marginsObject An object containing the margin values for the top, bottom, left, and right sides. unitCore.Document.OfficeEditor.LayoutUnits <optional>
'inch' The unit for the margin values. Returns:
- Type
- Promise.<void>
Example
const officeEditor = instance.Core.documentViewer.getDocument().getOfficeEditor(); await officeEditor.setSectionMargins({ top: 1, bottom: 1, left: 1, right: 1 }, 'inch'); -
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>
-
undo()
-
Undoes the last action in the office editor.
Returns:
Returns a promise that resolves when the operation is complete- 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' | 'formatted' <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 getPagePositionsfunction <optional>
Returns a promise that resolves to an array of objects containing {pageNumber: number, rect: Core.Math.Rect} for each annotation related to the tracked change.
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.