Functions for meetings
Control the visible range, cell selection, and editing state of a spreadsheet document using the JS-SDK.
JS-SDK V1.1.15 and later support these features.
API overview
|
API |
Type |
Description |
|
|
Property (read/write) |
Index of the leftmost visible column |
|
|
Property (read/write) |
Index of the topmost visible row |
|
|
Property (read) |
Range object for a cell or cell range |
|
|
Property (read) |
Range object for all cells in the worksheet |
|
|
Property (read) |
Range object for all columns in the worksheet |
|
|
Property (read) |
Range object for all rows in the worksheet |
|
|
Property (read) |
Range object for the used range in the worksheet |
|
|
Property (read) |
Index of the active sheet |
|
|
Method |
Exit cell editing mode |
|
|
Method |
Close all open drop-down panels |
|
|
Method |
Close the active hyperlink |
|
|
Method |
Close hover tips for filters |
|
|
Event |
Fires when the cell selection changes |
|
|
Event |
Fires when the user scrolls the worksheet |
|
|
Event |
Fires when the screen switches to landscape orientation |
In all syntax entries below, Expression refers to the document type application object (instance.Application).
---
Visible range
Set or get the leftmost visible column
Get or set the index of the leftmost visible column in the spreadsheet window. Type: number — readable and writable.
-
Syntax
Expression.ActiveWindow.ScrollColumnExpression: the document type application object.
-
Return value
Returns a
numberthat represents the leftmost column in the visible range. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the index of the leftmost visible column. const ScrollColumn = await app.ActiveWindow.ScrollColumn; console.log(ScrollColumn); // Set the index of the leftmost visible column. app.ActiveWindow.ScrollColumn = 10; }
Set or get the topmost visible row
Get or set the index of the topmost visible row in the spreadsheet window. Type: number — readable and writable.
-
Syntax
Expression.ActiveWindow.ScrollRowExpression: the document type application object.
-
Return value
Returns a
numberthat represents the topmost row in the visible range. -
Example
async function example() { await instance.ready(); const app = instance.Application; // Get the index of the topmost visible row. const ScrollRow = await app.ActiveWindow.ScrollRow; console.log(ScrollRow); // Set the index of the topmost visible row. app.ActiveWindow.ScrollRow = 10; }
Range selection
A cell or a range of cells
Get a range object that represents a cell or a cell range. Use the returned object to access range-related properties and methods.
-
Syntax
Expression.ActiveSheet.RangeExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // The worksheet object. const Sheet = await app.ActiveSheet; // A cell or a range of cells. const Range = await Sheet.Range; // Specify the cell. const range = await Range.Item("D2"); // You can also use range=await Range("D2") to specify the cell. // Select cell D2. await range.Select(); }
Get all cells in a worksheet
Get a range object that represents all cells in the active worksheet.
-
Syntax
Expression.ActiveSheet.CellsExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // The worksheet object. const Sheet = await app.ActiveSheet; // The cell objects. const cells = await Sheet.Cells; // Specify the cell. const cell = await cells.Item(1); // You can also use cell=await cells(1) to specify the cell. // Select the first cell. await cell.Select(); }
Get all columns in a worksheet
Get a range object that represents all columns in the active worksheet.
-
Syntax
Expression.ActiveSheet.ColumnsExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // The worksheet object. const Sheet = await app.ActiveSheet; // The column objects. const Columns = await Sheet.Columns; // Specify the column. const column = await Columns.Item(1); // You can also use column=await Columns(1) to specify the column. // Select the first column. await column.Select(); }
Get all rows in a worksheet
Get a range object that represents all rows in the active worksheet.
-
Syntax
Expression.ActiveSheet.RowsExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // The worksheet object. const Sheet = await app.ActiveSheet; // The row objects. const Rows = await Sheet.Rows; // Specify the row. const row = await Rows.Item(1); // You can also use row=await Rows(1) to specify the row. // Select the first row. await row.Select(); }
Get the used range in a worksheet
Get a range object that represents the used range in the active worksheet — the smallest rectangle that contains all cells with data.
-
Syntax
Expression.ActiveSheet.UsedRangeExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // The worksheet object. const Sheet = await app.ActiveSheet; // The used range in the worksheet. const UsedRange = await Sheet.UsedRange; // Select the used range. UsedRange.Select(); }
Listen to selection change events
Register a handler that fires whenever the cell selection changes in the worksheet.
-
Syntax
Expression.Sub.Worksheet_SelectionChange = FunctionExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Listen to selection change events. app.Sub.Worksheet_SelectionChange = (e) => { console.log('SelectionChange', e); }; }
Get the index of the active sheet
Get the index of the currently active sheet in the workbook. Type: number — read-only.
-
Syntax
Expression.ActiveSheet.IndexExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // The index of the active sheet. const Index = await app.ActiveSheet.Index; console.log(Index); }
Exit editing
Exit cell editing mode programmatically. Call this method to commit any in-progress cell edit and return focus to the sheet.
-
Syntax
Expression.ActiveWorkbook.QuitCellEdit()Expression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Exit editing. await app.ActiveWorkbook.QuitCellEdit(); }
Close all open drop-down panels
Close all drop-down panels that are currently open in the spreadsheet.
-
Syntax
Expression.ActiveWorkbook.CloseDropdownPanels()Expression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Close all open drop-down panels. await app.ActiveWorkbook.CloseDropdownPanels(); }
Close hyperlinks
Close the active hyperlink display in the spreadsheet.
-
Syntax
Expression.ActiveWorkbook.CloseHyperLink()Expression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Close hyperlinks. await app.ActiveWorkbook.CloseHyperLink(); }
Close hover tips for filters
Close the hover tooltip that appears when the user hovers over a filter icon.
-
Syntax
Expression.ActiveWorkbook.CloseFilterTips()Expression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Close hover tips for filters. await app.ActiveWorkbook.CloseFilterTips(); }
Listen to scroll events
Register a handler that fires whenever the user scrolls the worksheet.
-
Syntax
Expression.Sub.Worksheet_ScrollChange = FunctionExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Listen to scroll events. app.Sub.Worksheet_ScrollChange = () => { console.log('ScrollChange'); }; }
Listen to forced landscape events
Register a handler that fires when the device switches to forced landscape orientation.
-
Syntax
Expression.Sub.Worksheet_ForceLandscape = FunctionExpression: the document type application object.
-
Example
async function example() { await instance.ready(); const app = instance.Application; // Listen to forced landscape events. app.Sub.Worksheet_ForceLandscape = (e) => { console.log('ForceLandscape', e); }; }