The Binding object is a member of the Bindings collection. The Bindings collection contains all the Binding objects in a workbook.
| Property | Type | Description | Notes |
|---|---|---|---|
id |
String | String | The user-visible name of the binding. Get only. |
index |
Number | The zero-based index of the binding within the workbook | Binding.Index |
type |
String | Returns the type of the binding. Can be Table,Range or Text. Get only. |
Binding.Type |
None.
The Binding has the following methods defined:
| Method | Return Type | Description | Notes |
|---|---|---|---|
| getRange() | Range object | Returns the Range of the Binding | |
| getTable() | Table object | Returns the Table of the Binding | |
| getText() | String | Returns the text of the Binding |
Get a Range object that represents a single cell or a range of cells.
bindingObject.getRange();None.
Range object.
Below example uses binding to get the range.
var ctx = new Excel.ExcelClientContext();
var binding = ctx.workbook.bindings.getItemAt(0);
var range = binding.getRange();
ctx.load(range);
ctx.executeAsync().then(function() {
Console.log(range.cellCount);
});Get the table of the binding.
bindingObject.getTable();None
Table object.
var ctx = new Excel.ExcelClientContext();
var binding = ctx.workbook.bindings.getItemAt(0);
var table = binding.getTable();
ctx.load(table);
ctx.executeAsync().then(function () {
Console.log(table.name);
});Get the text of a binding.
bindingObject.getText();None.
String.
Below example uses binding to get the range.
var ctx = new Excel.ExcelClientContext();
var binding = ctx.workbook.bindings.getItemAt(0);
var text = binding.getText();
ctx.load(text);
ctx.executeAsync().then(function() {
Console.log(text);
});Get a Binding object properties.
bindingObject.type;| Property | Type | Description | Notes |
|---|---|---|---|
id |
String | String | The user-visible name of the binding |
index |
Number | The zero-based index of the binding within the workbook | Binding.Index |
type |
String | Returns the type of the binding. | Binding.Type |
Binding object.
Below example to get binding properties.
var ctx = new Excel.ExcelClientContext();
var binding = ctx.workbook.bindings.getItemAt(0);
ctx.load(binding);
ctx.executeAsync().then(function() {
Console.log(binding.type);
});