-
Notifications
You must be signed in to change notification settings - Fork 63
/
office.customxmlpart.yml
569 lines (504 loc) · 23 KB
/
office.customxmlpart.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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
### YamlMime:TSType
name: Office.CustomXmlPart
uid: 'office!Office.CustomXmlPart:interface'
package: office!
fullName: Office.CustomXmlPart
summary: >-
Represents a single CustomXMLPart in an [Office.CustomXmlParts](xref:office!Office.CustomXmlParts:interface)
collection.
remarks: '**Applications**: Word'
isPreview: false
isDeprecated: false
type: interface
properties:
- name: builtIn
uid: 'office!Office.CustomXmlPart#builtIn:member'
package: office!
fullName: builtIn
summary: 'True, if the custom XML part is built in; otherwise false.'
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'builtIn: boolean;'
return:
type: boolean
description: |-
#### Examples
```TypeScript
function showXMLPartBuiltIn() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
write(xmlPart.builtIn);
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
- name: id
uid: 'office!Office.CustomXmlPart#id:member'
package: office!
fullName: id
summary: Gets the GUID of the CustomXMLPart.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'id: string;'
return:
type: string
description: |-
#### Examples
```TypeScript
function showXMLPartBuiltId() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
write(xmlPart.id);
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
- name: namespaceManager
uid: 'office!Office.CustomXmlPart#namespaceManager:member'
package: office!
fullName: namespaceManager
summary: >-
Gets the set of namespace prefix mappings
([Office.CustomXmlPrefixMappings](xref:office!Office.CustomXmlPrefixMappings:interface)<!-- -->) used against the
current CustomXmlPart.
remarks: ''
isPreview: false
isDeprecated: false
syntax:
content: 'namespaceManager: CustomXmlPrefixMappings;'
return:
type: '<xref uid="office!Office.CustomXmlPrefixMappings:interface" />'
description: |-
#### Examples
```TypeScript
function setXMLPartNamespaceManagerNamespace() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.namespaceManager.addNamespaceAsync("myPrefix", "myNamespace");
});
}
```
methods:
- name: 'addHandlerAsync(eventType, handler, options, callback)'
uid: 'office!Office.CustomXmlPart#addHandlerAsync:member(1)'
package: office!
fullName: 'addHandlerAsync(eventType, handler, options, callback)'
summary: Adds an event handler to the object using the specified event type.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
You can add multiple event handlers for the specified eventType as long as the name of each event handler function
is unique.
isPreview: false
isDeprecated: false
syntax:
content: >-
addHandlerAsync(eventType: Office.EventType, handler: (result: any) => void, options?:
Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;
parameters:
- id: eventType
description: >-
Specifies the type of event to add. For a CustomXmlPart object, the eventType parameter can be specified as
`Office.EventType.NodeDeleted`<!-- -->, `Office.EventType.NodeInserted`<!-- -->, and
`Office.EventType.NodeReplaced`<!-- -->.
type: '<xref uid="office!Office.EventType:enum" />'
- id: handler
description: >-
The event handler function to add, whose only parameter is of type
[Office.NodeDeletedEventArgs](xref:office!Office.NodeDeletedEventArgs:interface)<!-- -->,
[Office.NodeInsertedEventArgs](xref:office!Office.NodeInsertedEventArgs:interface)<!-- -->, or
[Office.NodeReplacedEventArgs](xref:office!Office.NodeReplacedEventArgs:interface)
type: '(result: any) => void'
- id: options
description: 'Provides an option for preserving context data of any type, unchanged, for use in a callback.'
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'addHandlerAsync(eventType, handler, callback)'
uid: 'office!Office.CustomXmlPart#addHandlerAsync:member(2)'
package: office!
fullName: 'addHandlerAsync(eventType, handler, callback)'
summary: Adds an event handler to the object using the specified event type.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
You can add multiple event handlers for the specified eventType as long as the name of each event handler function
is unique.
#### Examples
```TypeScript
// To add an event handler for the NodeDeleted event, use the addHandlerAsync method of the CustomXmlPart object.
function addNodeDeletedEvent() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.addHandlerAsync(Office.EventType.NodeDeleted, function (eventArgs) {
write("A node has been deleted.");
});
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
```TypeScript
// To add an event handler for the NodeInserted event, use the addHandlerAsync method of the CustomXmlPart object.
function addNodeInsertedEvent() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.addHandlerAsync(Office.EventType.NodeInserted, function (eventArgs) {
write("A node has been inserted.");
});
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
```TypeScript
// To add an event handler for the NodeReplaced event, use the addHandlerAsync method of the CustomXmlPart object.
function addNodeReplacedEvent() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.addHandlerAsync(Office.EventType.NodeReplaced, function (eventArgs) {
write("A node has been replaced.");
});
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
isPreview: false
isDeprecated: false
syntax:
content: >-
addHandlerAsync(eventType: Office.EventType, handler: (result: any) => void, callback?: (result:
AsyncResult<void>) => void): void;
parameters:
- id: eventType
description: >-
Specifies the type of event to add. For a CustomXmlPart object, the eventType parameter can be specified as
`Office.EventType.NodeDeleted`<!-- -->, `Office.EventType.NodeInserted`<!-- -->, and
`Office.EventType.NodeReplaced`<!-- -->.
type: '<xref uid="office!Office.EventType:enum" />'
- id: handler
description: >-
The event handler function to add, whose only parameter is of type
[Office.NodeDeletedEventArgs](xref:office!Office.NodeDeletedEventArgs:interface)<!-- -->,
[Office.NodeInsertedEventArgs](xref:office!Office.NodeInsertedEventArgs:interface)<!-- -->, or
[Office.NodeReplacedEventArgs](xref:office!Office.NodeReplacedEventArgs:interface)
type: '(result: any) => void'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'deleteAsync(options, callback)'
uid: 'office!Office.CustomXmlPart#deleteAsync:member(1)'
package: office!
fullName: 'deleteAsync(options, callback)'
summary: Deletes the Custom XML Part.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
isPreview: false
isDeprecated: false
syntax:
content: 'deleteAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<void>) => void): void;'
parameters:
- id: options
description: 'Provides an option for preserving context data of any type, unchanged, for use in a callback.'
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: deleteAsync(callback)
uid: 'office!Office.CustomXmlPart#deleteAsync:member(2)'
package: office!
fullName: deleteAsync(callback)
summary: Deletes the Custom XML Part.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
#### Examples
```TypeScript
function deleteXMLPart() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.deleteAsync(function (eventArgs) {
write("The XML Part has been deleted.");
});
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'deleteAsync(callback?: (result: AsyncResult<void>) => void): void;'
parameters:
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'getNodesAsync(xPath, options, callback)'
uid: 'office!Office.CustomXmlPart#getNodesAsync:member(1)'
package: office!
fullName: 'getNodesAsync(xPath, options, callback)'
summary: Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
isPreview: false
isDeprecated: false
syntax:
content: >-
getNodesAsync(xPath: string, options?: Office.AsyncContextOptions, callback?: (result:
AsyncResult<CustomXmlNode[]>) => void): void;
parameters:
- id: xPath
description: An XPath expression that specifies the nodes you want returned. Required.
type: string
- id: options
description: 'Provides an option for preserving context data of any type, unchanged, for use in a callback.'
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->. The `value` property of the result
is an array of CustomXmlNode objects that represent the nodes specified by the XPath expression passed to
the xPath parameter.
type: >-
(result: <xref uid="office!Office.AsyncResult:interface" /><<xref
uid="office!Office.CustomXmlNode:interface" />[]>) => void
return:
type: void
description: ''
- name: 'getNodesAsync(xPath, callback)'
uid: 'office!Office.CustomXmlPart#getNodesAsync:member(2)'
package: office!
fullName: 'getNodesAsync(xPath, callback)'
summary: Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath. / *
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
#### Examples
```TypeScript
function showXmlNodeType() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.getNodesAsync('*/*', function (nodeResults) {
for (let i = 0; i < nodeResults.value.length; i++) {
const node = nodeResults.value[i];
write(node.nodeType);
}
});
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'getNodesAsync(xPath: string, callback?: (result: AsyncResult<CustomXmlNode[]>) => void): void;'
parameters:
- id: xPath
description: An XPath expression that specifies the nodes you want returned. Required.
type: string
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->. The `value` property of the result
is an array of CustomXmlNode objects that represent the nodes specified by the XPath expression passed to
the xPath parameter.
type: >-
(result: <xref uid="office!Office.AsyncResult:interface" /><<xref
uid="office!Office.CustomXmlNode:interface" />[]>) => void
return:
type: void
description: ''
- name: 'getXmlAsync(options, callback)'
uid: 'office!Office.CustomXmlPart#getXmlAsync:member(1)'
package: office!
fullName: 'getXmlAsync(options, callback)'
summary: Asynchronously gets the XML inside this custom XML part.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
isPreview: false
isDeprecated: false
syntax:
content: 'getXmlAsync(options?: Office.AsyncContextOptions, callback?: (result: AsyncResult<string>) => void): void;'
parameters:
- id: options
description: 'Provides an option for preserving context data of any type, unchanged, for use in a callback.'
type: '<xref uid="office!Office.AsyncContextOptions:interface" />'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->. The `value` property of the result
is a string that contains the XML of the referenced CustomXmlPart object.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><string>) => void'
return:
type: void
description: ''
- name: getXmlAsync(callback)
uid: 'office!Office.CustomXmlPart#getXmlAsync:member(2)'
package: office!
fullName: getXmlAsync(callback)
summary: Asynchronously gets the XML inside this custom XML part.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
#### Examples
```TypeScript
function showXMLPartInnerXML() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}", function (result) {
const xmlPart = result.value;
xmlPart.getXmlAsync(function (eventArgs) {
write(eventArgs.value);
});
});
}
// Function that writes to a div with id='message' on the page.
function write(message){
document.getElementById('message').innerText += message;
}
```
isPreview: false
isDeprecated: false
syntax:
content: 'getXmlAsync(callback?: (result: AsyncResult<string>) => void): void;'
parameters:
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->. The `value` property of the result
is a string that contains the XML of the referenced CustomXmlPart object.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><string>) => void'
return:
type: void
description: ''
- name: 'removeHandlerAsync(eventType, handler, options, callback)'
uid: 'office!Office.CustomXmlPart#removeHandlerAsync:member(1)'
package: office!
fullName: 'removeHandlerAsync(eventType, handler, options, callback)'
summary: Removes an event handler for the specified event type.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
isPreview: false
isDeprecated: false
syntax:
content: >-
removeHandlerAsync(eventType: Office.EventType, handler?: (result: any) => void, options?: RemoveHandlerOptions,
callback?: (result: AsyncResult<void>) => void): void;
parameters:
- id: eventType
description: >-
Specifies the type of event to remove. For a CustomXmlPart object, the eventType parameter can be specified
as `Office.EventType.NodeDeleted`<!-- -->, `Office.EventType.NodeInserted`<!-- -->, and
`Office.EventType.NodeReplaced`<!-- -->.
type: '<xref uid="office!Office.EventType:enum" />'
- id: handler
description: The name of the handler to remove.
type: '(result: any) => void'
- id: options
description: Provides options to determine which event handler or handlers are removed.
type: '<xref uid="office!Office.RemoveHandlerOptions:interface" />'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''
- name: 'removeHandlerAsync(eventType, handler, callback)'
uid: 'office!Office.CustomXmlPart#removeHandlerAsync:member(2)'
package: office!
fullName: 'removeHandlerAsync(eventType, handler, callback)'
summary: Removes an event handler for the specified event type.
remarks: >-
**Requirement set**:
[CustomXmlParts](https://learn.microsoft.com/javascript/api/requirement-sets/common/office-add-in-requirement-sets#customxmlparts)
#### Examples
```TypeScript
function removeNodeInsertedEventHandler() {
Office.context.document.customXmlParts.getByIdAsync(
"{3BC85265-09D6-4205-B665-8EB239A8B9A1}",
function (result) {
const xmlPart = result.value;
xmlPart.removeHandlerAsync(Office.EventType.DataNodeInserted, {handler:myHandler});
});
}
```
isPreview: false
isDeprecated: false
syntax:
content: >-
removeHandlerAsync(eventType: Office.EventType, handler?: (result: any) => void, callback?: (result:
AsyncResult<void>) => void): void;
parameters:
- id: eventType
description: >-
Specifies the type of event to remove. For a CustomXmlPart object, the eventType parameter can be specified
as `Office.EventType.NodeDeleted`<!-- -->, `Office.EventType.NodeInserted`<!-- -->, and
`Office.EventType.NodeReplaced`<!-- -->.
type: '<xref uid="office!Office.EventType:enum" />'
- id: handler
description: The name of the handler to remove.
type: '(result: any) => void'
- id: callback
description: >-
Optional. A function that is invoked when the callback returns, whose only parameter is of type
[Office.AsyncResult](xref:office!Office.AsyncResult:interface)<!-- -->.
type: '(result: <xref uid="office!Office.AsyncResult:interface" /><void>) => void'
return:
type: void
description: ''