What's new in Excel JavaScript API 1.4
The following are the new additions to the Excel JavaScript APIs in requirement set 1.4.
Named item add and new properties
New properties:
comment
scope
- Worksheet or workbook scoped items.worksheet
- Returns the worksheet on which the named item is scoped to.
New methods:
add(name: string, reference: Range or string, comment: string)
- Adds a new name to the collection of the given scope.addFormulaLocal(name: string, formula: string, comment: string)
- Adds a new name to the collection of the given scope using the user's locale for the formula.
Settings API in the Excel namespace
The Setting object represents a key:value pair for a setting persisted to the document. The functionality of Excel.Setting
is equivalent to Office.Settings
, but uses the batched API syntax, rather than the Common API's callback model.
APIs include getItem()
to get setting entry via the key and add()
to add the specified key:value setting pair to the workbook.
Others
- Set the table column name.
- Add a table column to the end of the table.
- Add multiple rows to a table at a time.
range.getColumnsAfter(count: number)
andrange.getColumnsBefore(count: number)
to get a certain number of columns to the right/left of the current Range object.- The *OrNullObject methods and properties: This functionality allows getting an object using a key. If the object does not exist, the returned object's
isNullObject
property will be true. This allows developers to check if an object exists without having to handle it through exception handling. An*OrNullObject
method is available on most collection objects.
worksheet.getItemOrNullObject("itemName")
API list
The following table lists the APIs in Excel JavaScript API requirement set 1.4. To view API reference documentation for all APIs supported by Excel JavaScript API requirement set 1.4 or earlier, see Excel APIs in requirement set 1.4 or earlier.
Class | Fields | Description |
---|---|---|
BindingCollection | getCount() | Gets the number of bindings in the collection. |
getItemOrNullObject(id: string) | Gets a binding object by ID. | |
ChartCollection | getCount() | Returns the number of charts in the worksheet. |
getItemOrNullObject(name: string) | Gets a chart using its name. | |
ChartPointsCollection | getCount() | Returns the number of chart points in the series. |
ChartSeriesCollection | getCount() | Returns the number of series in the collection. |
NamedItem | comment | Specifies the comment associated with this name. |
delete() | Deletes the given name. | |
getRangeOrNullObject() | Returns the range object that is associated with the name. | |
scope | Specifies if the name is scoped to the workbook or to a specific worksheet. | |
worksheet | Returns the worksheet on which the named item is scoped to. | |
worksheetOrNullObject | Returns the worksheet to which the named item is scoped. | |
NamedItemCollection | add(name: string, reference: Range | string, comment?: string) | Adds a new name to the collection of the given scope. |
addFormulaLocal(name: string, formula: string, comment?: string) | Adds a new name to the collection of the given scope using the user's locale for the formula. | |
getCount() | Gets the number of named items in the collection. | |
getItemOrNullObject(name: string) | Gets a NamedItem object using its name. |
|
PivotTableCollection | getCount() | Gets the number of pivot tables in the collection. |
getItemOrNullObject(name: string) | Gets a PivotTable by name. | |
Range | getIntersectionOrNullObject(anotherRange: Range | string) | Gets the range object that represents the rectangular intersection of the given ranges. |
getUsedRangeOrNullObject(valuesOnly?: boolean) | Returns the used range of the given range object. | |
RangeViewCollection | getCount() | Gets the number of RangeView objects in the collection. |
Setting | delete() | Deletes the setting. |
key | The key that represents the ID of the setting. | |
value | Represents the value stored for this setting. | |
SettingCollection | add(key: string, value: string | number | boolean | Date | any[] | any) | Sets or adds the specified setting to the workbook. |
getCount() | Gets the number of settings in the collection. | |
getItem(key: string) | Gets a setting entry via the key. | |
getItemOrNullObject(key: string) | Gets a setting entry via the key. | |
items | Gets the loaded child items in this collection. | |
onSettingsChanged | Occurs when the settings in the document are changed. | |
SettingsChangedEventArgs | settings | Gets the Setting object that represents the binding that raised the settings changed event |
TableCollection | getCount() | Gets the number of tables in the collection. |
getItemOrNullObject(key: string) | Gets a table by name or ID. | |
TableColumnCollection | getCount() | Gets the number of columns in the table. |
getItemOrNullObject(key: number | string) | Gets a column object by name or ID. | |
TableRowCollection | getCount() | Gets the number of rows in the table. |
Workbook | settings | Represents a collection of settings associated with the workbook. |
Worksheet | getUsedRangeOrNullObject(valuesOnly?: boolean) | The used range is the smallest range that encompasses any cells that have a value or formatting assigned to them. |
names | Collection of names scoped to the current worksheet. | |
WorksheetCollection | getCount(visibleOnly?: boolean) | Gets the number of worksheets in the collection. |
getItemOrNullObject(key: string) | Gets a worksheet object using its name or ID. |
See also
Office Add-ins