-
getEditMode()
-
Retrieves the current edit mode status of the spreadsheet editor.
Returns:
The current edit mode.
-
Type
-
Core.SpreadsheetEditor.SpreadsheetEditorEditMode
-
getSelectedCellRange()
-
Retrieves the currently selected cell range in the spreadsheet editor.
Returns:
The currently selected cell range as a CellRange object.
-
Type
-
Core.SpreadsheetEditor.CellRange
-
getSelectedCells()
-
Retrieves the cells in an array from the currently selected CellRange.
Returns:
An array of Cell classes representing the cells in the selected range.
-
Type
-
Array.<Core.SpreadsheetEditor.Cell>
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager()
const cells = spreadsheetEditorManager.getSelectedCells();
-
setEditMode(editMode)
-
Sets the current edit mode for the spreadsheet editor.
Parameters:
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager()
spreadsheetEditorManager.setEditMode(Core.SpreadsheetEditor.SpreadsheetEditorEditMode.VIEW_ONLY);
-
setSelectedCellsStyle(styleObject)
-
Sets the style of the cells in the currently selected cell range in the Spreadsheet Editor.
Parameters:
Name |
Type |
Description |
styleObject |
object
|
The style object containing the style key and the value to be applied to the selected cell range.
Properties
Name |
Type |
Argument |
Description |
verticalAlignment |
number
|
<optional>
|
The vertical alignment of the cell's content. |
horizontalAlignment |
number
|
<optional>
|
The horizontal alignment of the cell's content. |
font |
object
|
<optional>
|
The font object containing the font properties to be applied to the cell.
Properties
Name |
Type |
Argument |
Description |
fontFace |
string
|
<optional>
|
The font name to be applied to the cell. |
pointSize |
number
|
<optional>
|
The font size in points to be applied to the cell. |
color |
string
|
<optional>
|
The font color to be applied to the cell. |
bold |
boolean
|
<optional>
|
The bold style to be applied to the cell. |
italic |
boolean
|
<optional>
|
The italic style to be applied to the cell. |
underline |
boolean
|
<optional>
|
The underline style to be applied to the cell. |
strikeout |
boolean
|
<optional>
|
The strikeout style to be applied to the cell. |
|
formatString |
number
|
<optional>
|
The format string for the cell's content. |
merge |
boolean
|
<optional>
|
Indicates whether the selected cell range should be merged or unmerged. If there is multiple styles being applied, the merge option will be executed at last after applying the other styles. |
border |
Core.SpreadsheetEditor.Types.RangeBorderOptions
|
<optional>
|
The border option object. When this option is set, the other options being passed in will be ignored. |
|
Example
const { Core } = window.getInstance();
const spreadsheetEditorManager = Core.documentViewer.getSpreadsheetEditorManager();
const styleObject = {
verticalAlignment: Core.SpreadsheetEditor.Types.VerticalAlignment.CENTER,
horizontalAlignment: Core.SpreadsheetEditor.Types.HorizontalAlignment.CENTER,
font: {
fontFace: 'Arial',
pointSize: 12,
color: '#000000',
bold: true,
italic: false,
underline: false,
strikeout: false
},
}
spreadsheetEditorManager.setSelectedCellsStyle(styleObject);
-
activeSheetChanged
-
The event that fires when the current active sheet changed.
Parameters:
Name |
Type |
Description |
activeSheetChangedEventObject |
object
|
Properties
Name |
Type |
Description |
getSheetIndex |
function
|
Returns the current active sheet index. |
|
-
-
The event that fires when a formula is selected
Parameters:
Name |
Type |
Description |
formulaBarSelectionChangedEventObject |
object
|
Properties
Name |
Type |
Description |
getSelectionPosition |
function
|
Returns the new selection position (0-indexed). |
|
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
const handleFormulaBarSelectionChangedEvent = (event) => {
const inputPosition = event.getSelectionPosition();
// console.log('inputPosition', inputPosition);
};
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.FORMULA_BAR_SELECTION_CHANGED, handleFormulaBarSelectionChangedEvent);
-
formulaBarTextChangedEvent
-
The event that fires when the formula bar text input is changed.
Parameters:
Name |
Type |
Description |
formulaBarTextChangedEventObject |
object
|
Properties
Name |
Type |
Description |
getInfo |
function
|
Returns an object containing the formula name and details. |
|
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
const handleFormulaBarTextChanged = (event) => {
const segments = event.getInfo();
// console.log('segments: ', segments);
};
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.FORMULA_BAR_TEXT_CHANGED, handleFormulaBarTextChanged);
-
-
The event that fires when the selection of a formula is confirmed
Parameters:
Name |
Type |
Description |
formulaHelpEventObject |
object
|
Properties
Name |
Type |
Description |
getFormulaInfo |
function
|
Returns an object containing the formula name and description. |
|
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
const handleFormulaHelpEvent = (event) => {
// console.log('helpful formula info: ', event.getFormulaInfo());
};
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.FORMULA_HELP, formulaHelpEvent);
-
-
The event that fires when a search of formula is performed.
Parameters:
Name |
Type |
Description |
formulaSearchEventObject |
object
|
Properties
Name |
Type |
Description |
getFormulaInfoItems |
function
|
Returns a list of formula info items matching the formula search query. |
|
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
const handleFormulaSearchEvent = (event) => {
const items = event.getFormulaInfoItems();
// console.log('items: ', items);
};
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.FORMULA_SEARCH, handleFormulaBarTextChanged);
-
selectedRangeStyleChanged
-
The event that fires when the cell style of the selected range changed.
Parameters:
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.SELECTED_RANGE_STYLE_CHANGED, () => {
// console.log('SELECTED_RANGE_STYLE_CHANGED')
});
-
selectionChanged
-
The event that fires when the cell selection is changed in the editor.
Parameters:
Name |
Type |
Description |
selectionChangedEventObject |
object
|
Properties
Name |
Type |
Description |
getCellRange |
function
|
Returns a CellRange object representing the selected cell(s). |
getBoundingCells |
function
|
Returns an array of one or two Cells representing the top-left and bottom-right corners of the selection. |
getSelectionRangeDisplayValue |
function
|
Returns a string representing the display value of the selected range (e.g. 'A1' or 'A1:B2'). |
isMerged |
function
|
Returns true if the entire selected range consists of merged cells only. Returns false if the selection contains any unmerged cells or is a mix of merged and unmerged ranges. |
getClipboard |
function
|
Returns the SpreadsheetEditorClipboard object associated with the current editor instance. |
|
Examples
// getCellRange
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(
SpreadsheetEditor.SpreadsheetEditorManager.Events.SELECTION_CHANGED,
(event) => {
const range = event.getCellRange();
}
);
// getBoundingCells
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(
SpreadsheetEditor.SpreadsheetEditorManager.Events.SELECTION_CHANGED,
(event) => {
const [topLeftCell, bottomRightCell] = event.getBoundingCells();
}
);
// getSelectionRangeDisplayValue
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(
SpreadsheetEditor.SpreadsheetEditorManager.Events.SELECTION_CHANGED,
(event) => {
const displayValue = event.getSelectionRangeDisplayValue();
}
);
// isMerged
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(
SpreadsheetEditor.SpreadsheetEditorManager.Events.SELECTION_CHANGED,
(event) => {
const isFullyMerged = event.isMerged();
}
);
// getClipboard
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(
SpreadsheetEditor.SpreadsheetEditorManager.Events.SELECTION_CHANGED,
(event) => {
const clipboard = event.getClipboard();
if (clipboard.canCopy()) {
clipboard.copy();
}
}
);
-
spreadsheetEditorEditModeChanged
-
The event that fires when the spreadsheet editor mode changed.
Parameters:
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.EDIT_MODE_CHANGED, () => {
// console.log('EDIT_MODE_CHANGED')
});
-
spreadsheetEditorReady
-
The event that fires when the spreadsheet document is loaded and ready to be used.
Example
const instance = WebViewer.getInstance();
const { documentViewer, SpreadsheetEditor } = instance.Core;
const spreadsheetEditorManager = documentViewer.getSpreadsheetEditorManager();
spreadsheetEditorManager.addEventListener(SpreadsheetEditor.SpreadsheetEditorManager.Events.SPREADSHEET_EDITOR_READY, () => {
// console.log('SPREADSHEET_EDITOR_READY')
});