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 BODY
string body stream HEADER
string header stream FOOTER
string footer stream -
<static> EditMode
-
An enum representing the available edit modes in Office Editor.
Properties:
Name Type Description EDITING
string normal editing mode REVIEWING
string review mode. Any edits create track changes. VIEW_ONLY
string Read only mode. No editing is available. PREVIEW
string 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 BULLET
string "●", "●", "●" BULLET_SQUARE
string "●", "●", "■" SQUARE_BULLET
string "■", "●", "●" DIAMOND
string "❖", "●", "○" CHECK
string "✔", "●", "○" ARROW
string "⇨", "●", "○" NUMBER_LATIN_ROMAN_1
string "1.", "a.", "i." NUMBER_DECIMAL
string "1.", "1.1", "1.1.1" NUMBER_LATIN_ROMAN_2
string "1)", "a)", "i)" LATIN_ROMAN
string "A.", "a.", i." ROMAN_LATIN_NUMBER
string "I.", "A.", "1." -
<static> ToggleableStyles
-
An enum representing the toggleable text styles in Office Editor.
Properties:
Name Type Description BOLD
string 'bold' ITALIC
string 'italic' UNDERLINE
string 'underline'
Methods
-
acceptTrackedChange(id)
-
Accepts a tracked change in Office Editor Document.
Parameters:
Name Type Description id
number 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 pageNumber
number 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 withFormatting
boolean Whether to paste with formatting or not. -
rejectTrackedChange(id)
-
Rejects a tracked change in Office Editor Document.
Parameters:
Name Type Description id
number 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 pageNumber
number 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 pageNumber
number 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 widthsAndSpacing
Array.<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 editMode
Core.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 numberOfColumns
number <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 listStyleEnum
Core.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 style
Core.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 style
Core.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 style
Core.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 style
Core.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 paragraphProperties
object <optional>
The properties of the paragraph -
ParagraphStyle
-
Type:
- Object
Properties:
Name Type Argument Description paragraphTextStyle
Core.Document.OfficeEditor.TextStyle <optional>
The text style of the paragraph. justification
Object <optional>
The justification of the paragraph. lineHeightMultiplier
number <optional>
The line height multiplier of the paragraph. -
SelectionStyle
-
Type:
- Object
Properties:
Name Type Argument Description paragraphProperties
object <optional>
The properties of the paragraph -
TextStyle
-
Type:
- Object
Properties:
Name Type Argument Description bold
boolean <optional>
Whether the selected text should be bold italic
boolean <optional>
Whether the selected text should be italic underline
boolean <optional>
Whether the selected text should have underline fontFace
string <optional>
The font face of the text pointSize
number <optional>
The point size of the text color
object <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 id
number <optional>
The id of the tracked change type
'inserted' | 'deleted' <optional>
The type of the tracked change author
string <optional>
The author of the tracked change date
Date <optional>
The date of the tracked change plaintext
string <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 cursorProperties
Core.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 selectionProperties
Core.Document.OfficeEditor.SelectionStyle The selection properties. -
trackedChangesUpdated
-
Triggered only in an Office Editor document whenever a tracked change is added, removed, or modified.