-
Notifications
You must be signed in to change notification settings - Fork 63
/
excel.bindingcollection.yml
388 lines (378 loc) · 15.6 KB
/
excel.bindingcollection.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
### YamlMime:TSType
name: Excel.BindingCollection
uid: 'excel!Excel.BindingCollection:class'
package: excel!
fullName: Excel.BindingCollection
summary: Represents the collection of all the binding objects that are part of the workbook.
remarks: '\[ [API set: ExcelApi 1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
type: class
properties:
- name: context
uid: 'excel!Excel.BindingCollection#context:member'
package: excel!
fullName: context
summary: >-
The request context associated with the object. This connects the add-in's process to the Office host
application's process.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'context: RequestContext;'
return:
type: '<xref uid="excel!Excel.RequestContext:class" />'
- name: count
uid: 'excel!Excel.BindingCollection#count:member'
package: excel!
fullName: count
summary: Returns the number of bindings in the collection.
remarks: '\[ [API set: ExcelApi 1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly count: number;'
return:
type: number
- name: items
uid: 'excel!Excel.BindingCollection#items:member'
package: excel!
fullName: items
summary: Gets the loaded child items in this collection.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'readonly items: Excel.Binding[];'
return:
type: '<xref uid="excel!Excel.Binding:class" />[]'
methods:
- name: 'add(range, bindingType, id)'
uid: 'excel!Excel.BindingCollection#add:member(1)'
package: excel!
fullName: 'add(range, bindingType, id)'
summary: Add a new binding to a particular Range.
remarks: '\[ [API set: ExcelApi 1.3](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'add(range: Range | string, bindingType: Excel.BindingType, id: string): Excel.Binding;'
parameters:
- id: range
description: >-
Range to bind the binding to. May be a `Range` object or a string. If string, must contain the full address,
including the sheet name
type: '<xref uid="excel!Excel.Range:class" /> | string'
- id: bindingType
description: Type of binding. See `Excel.BindingType`<!-- -->.
type: '<xref uid="excel!Excel.BindingType:enum" />'
- id: id
description: Name of the binding.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: 'add(range, bindingTypeString, id)'
uid: 'excel!Excel.BindingCollection#add:member(2)'
package: excel!
fullName: 'add(range, bindingTypeString, id)'
summary: Add a new binding to a particular Range.
remarks: '\[ [API set: ExcelApi 1.3](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'add(range: Range | string, bindingTypeString: "Range" | "Table" | "Text", id: string): Excel.Binding;'
parameters:
- id: range
description: >-
Range to bind the binding to. May be a `Range` object or a string. If string, must contain the full address,
including the sheet name
type: '<xref uid="excel!Excel.Range:class" /> | string'
- id: bindingTypeString
description: Type of binding. See `Excel.BindingType`<!-- -->.
type: '"Range" | "Table" | "Text"'
- id: id
description: Name of the binding.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: 'addFromNamedItem(name, bindingType, id)'
uid: 'excel!Excel.BindingCollection#addFromNamedItem:member(1)'
package: excel!
fullName: 'addFromNamedItem(name, bindingType, id)'
summary: >-
Add a new binding based on a named item in the workbook. If the named item references to multiple areas, the
`InvalidReference` error will be returned.
remarks: '\[ [API set: ExcelApi 1.3](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'addFromNamedItem(name: string, bindingType: Excel.BindingType, id: string): Excel.Binding;'
parameters:
- id: name
description: Name from which to create binding.
type: string
- id: bindingType
description: Type of binding. See `Excel.BindingType`<!-- -->.
type: '<xref uid="excel!Excel.BindingType:enum" />'
- id: id
description: Name of the binding.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: 'addFromNamedItem(name, bindingTypeString, id)'
uid: 'excel!Excel.BindingCollection#addFromNamedItem:member(2)'
package: excel!
fullName: 'addFromNamedItem(name, bindingTypeString, id)'
summary: >-
Add a new binding based on a named item in the workbook. If the named item references to multiple areas, the
`InvalidReference` error will be returned.
remarks: '\[ [API set: ExcelApi 1.3](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'addFromNamedItem(name: string, bindingTypeString: "Range" | "Table" | "Text", id: string): Excel.Binding;'
parameters:
- id: name
description: Name from which to create binding.
type: string
- id: bindingTypeString
description: Type of binding. See `Excel.BindingType`<!-- -->.
type: '"Range" | "Table" | "Text"'
- id: id
description: Name of the binding.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: 'addFromSelection(bindingType, id)'
uid: 'excel!Excel.BindingCollection#addFromSelection:member(1)'
package: excel!
fullName: 'addFromSelection(bindingType, id)'
summary: >-
Add a new binding based on the current selection. If the selection has multiple areas, the `InvalidReference`
error will be returned.
remarks: '\[ [API set: ExcelApi 1.3](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'addFromSelection(bindingType: Excel.BindingType, id: string): Excel.Binding;'
parameters:
- id: bindingType
description: Type of binding. See `Excel.BindingType`<!-- -->.
type: '<xref uid="excel!Excel.BindingType:enum" />'
- id: id
description: Name of the binding.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: 'addFromSelection(bindingTypeString, id)'
uid: 'excel!Excel.BindingCollection#addFromSelection:member(2)'
package: excel!
fullName: 'addFromSelection(bindingTypeString, id)'
summary: >-
Add a new binding based on the current selection. If the selection has multiple areas, the `InvalidReference`
error will be returned.
remarks: '\[ [API set: ExcelApi 1.3](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'addFromSelection(bindingTypeString: "Range" | "Table" | "Text", id: string): Excel.Binding;'
parameters:
- id: bindingTypeString
description: Type of binding. See `Excel.BindingType`<!-- -->.
type: '"Range" | "Table" | "Text"'
- id: id
description: Name of the binding.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: getCount()
uid: 'excel!Excel.BindingCollection#getCount:member(1)'
package: excel!
fullName: getCount()
summary: Gets the number of bindings in the collection.
remarks: '\[ [API set: ExcelApi 1.4](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getCount(): OfficeExtension.ClientResult<number>;'
return:
type: '<xref uid="office!OfficeExtension.ClientResult:class" /><number>'
description: ''
- name: getItem(id)
uid: 'excel!Excel.BindingCollection#getItem:member(1)'
package: excel!
fullName: getItem(id)
summary: Gets a binding object by ID.
remarks: |-
\[ [API set: ExcelApi 1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
async function onBindingDataChanged(eventArgs) {
await Excel.run(async (context) => {
// Highlight the table related to the binding in orange to indicate data has been changed.
context.workbook.bindings.getItem(eventArgs.binding.id).getTable().getDataBodyRange().format.fill.color = "Orange";
await context.sync();
console.log("The value in this table got changed!");
});
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'getItem(id: string): Excel.Binding;'
parameters:
- id: id
description: ID of the binding object to be retrieved.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: getItemAt(index)
uid: 'excel!Excel.BindingCollection#getItemAt:member(1)'
package: excel!
fullName: getItemAt(index)
summary: Gets a binding object based on its position in the items array.
remarks: |-
\[ [API set: ExcelApi 1.1](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]
#### Examples
```TypeScript
await Excel.run(async (context) => {
const lastPosition = context.workbook.bindings.count - 1;
const binding = context.workbook.bindings.getItemAt(lastPosition);
binding.load('type')
await context.sync();
console.log(binding.type);
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'getItemAt(index: number): Excel.Binding;'
parameters:
- id: index
description: Index value of the object to be retrieved. Zero-indexed.
type: number
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: getItemOrNullObject(id)
uid: 'excel!Excel.BindingCollection#getItemOrNullObject:member(1)'
package: excel!
fullName: getItemOrNullObject(id)
summary: >-
Gets a binding object by ID. If the binding object does not exist, then this method returns an object with its
`isNullObject` property set to `true`<!-- -->. For further information, see [*OrNullObject methods and
properties](https://learn.microsoft.com/office/dev/add-ins/develop/application-specific-api-model#ornullobject-methods-and-properties)<!--
-->.
remarks: '\[ [API set: ExcelApi 1.4](/javascript/api/requirement-sets/excel/excel-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getItemOrNullObject(id: string): Excel.Binding;'
parameters:
- id: id
description: ID of the binding object to be retrieved.
type: string
return:
type: '<xref uid="excel!Excel.Binding:class" />'
description: ''
- name: load(options)
uid: 'excel!Excel.BindingCollection#load:member(1)'
package: excel!
fullName: load(options)
summary: >-
Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading
the properties.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: >-
load(options?: Excel.Interfaces.BindingCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions):
Excel.BindingCollection;
parameters:
- id: options
description: Provides options for which properties of the object to load.
type: >-
<xref uid="excel!Excel.Interfaces.BindingCollectionLoadOptions:interface" /> & <xref
uid="excel!Excel.Interfaces.CollectionLoadOptions:interface" />
return:
type: '<xref uid="excel!Excel.BindingCollection:class" />'
description: ''
- name: load(propertyNames)
uid: 'excel!Excel.BindingCollection#load:member(2)'
package: excel!
fullName: load(propertyNames)
summary: >-
Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading
the properties.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'load(propertyNames?: string | string[]): Excel.BindingCollection;'
parameters:
- id: propertyNames
description: A comma-delimited string or an array of strings that specify the properties to load.
type: 'string | string[]'
return:
type: '<xref uid="excel!Excel.BindingCollection:class" />'
description: |-
#### Examples
```TypeScript
await Excel.run(async (context) => {
const bindings = context.workbook.bindings;
bindings.load('items');
await context.sync();
for (let i = 0; i < bindings.items.length; i++) {
console.log(bindings.items[i].id);
}
});
```
- name: load(propertyNamesAndPaths)
uid: 'excel!Excel.BindingCollection#load:member(3)'
package: excel!
fullName: load(propertyNamesAndPaths)
summary: >-
Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading
the properties.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'load(propertyNamesAndPaths?: OfficeExtension.LoadOption): Excel.BindingCollection;'
parameters:
- id: propertyNamesAndPaths
description: >-
`propertyNamesAndPaths.select` is a comma-delimited string that specifies the properties to load, and
`propertyNamesAndPaths.expand` is a comma-delimited string that specifies the navigation properties to load.
type: '<xref uid="office!OfficeExtension.LoadOption:interface" />'
return:
type: '<xref uid="excel!Excel.BindingCollection:class" />'
description: ''
- name: toJSON()
uid: 'excel!Excel.BindingCollection#toJSON:member(1)'
package: excel!
fullName: toJSON()
summary: >-
Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to
`JSON.stringify()`<!-- -->. (`JSON.stringify`<!-- -->, in turn, calls the `toJSON` method of the object that is
passed to it.) Whereas the original `Excel.BindingCollection` object is an API object, the `toJSON` method returns
a plain JavaScript object (typed as `Excel.Interfaces.BindingCollectionData`<!-- -->) that contains an "items"
array with shallow copies of any loaded properties from the collection's items.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'toJSON(): Excel.Interfaces.BindingCollectionData;'
return:
type: '<xref uid="excel!Excel.Interfaces.BindingCollectionData:interface" />'
description: ''
extends: '<xref uid="office!OfficeExtension.ClientObject:class" />'