forked from jbaroudi/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoffice-js.d.ts
5294 lines (5286 loc) · 200 KB
/
office-js.d.ts
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
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Office.js
// Project: http://dev.office.com
// Definitions by: OfficeDev <https://github.com/OfficeDev>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/*
office-js
Copyright (c) Microsoft Corporation
*/
declare module Office {
export var context: Context;
/**
* This method is called after the Office API was loaded.
* @param reason Indicates how the app was initialized
*/
export function initialize(reason: InitializationReason): void;
/**
* Indicates if the large namespace for objects will be used or not.
* @param useShortNamespace Indicates if 'true' that the short namespace will be used
*/
export function useShortNamespace(useShortNamespace: boolean): void;
// Enumerations
export enum AsyncResultStatus {
/**
* Operation succeeded
*/
Succeeded,
/**
* Operation failed, check error object
*/
Failed
}
export enum InitializationReason {
/**
* Indicates the app was just inserted in the document
*/
Inserted,
/**
* Indicates if the extension already existed in the document
*/
DocumentOpened
}
// Objects
export interface AsyncResult {
asyncContext: any;
status: AsyncResultStatus;
error: Error;
value: any;
}
export interface Context {
contentLanguage: string;
displayLanguage: string;
license: string;
touchEnabled: boolean;
requirements: {
/**
* Check if the specified requirement set is supported by the host Office application.
* @param name - Set name. e.g.: "MatrixBindings".
* @param minVersion - The minimum required version.
*/
isSetSupported(name: string, minVersion?: number): boolean;
}
}
export interface Error {
message: string;
name: string;
}
}
declare module OfficeExtension {
/** An abstract proxy object that represents an object in an Office document. You create proxy objects from the context (or from other proxy objects), add commands to a queue to act on the object, and then synchronize the proxy object state with the document by calling "context.sync()". */
class ClientObject {
/** The request context associated with the object */
context: ClientRequestContext;
}
}
declare module OfficeExtension {
interface LoadOption {
select?: string | string[];
expand?: string | string[];
top?: number;
skip?: number;
}
/** An abstract RequestContext object that facilitates requests to the host Office application. The "Excel.run" and "Word.run" methods provide a request context. */
class ClientRequestContext {
constructor(url?: string);
/** Collection of objects that are tracked for automatic adjustments based on surrounding changes in the document. */
trackedObjects: TrackedObjects;
/** Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. */
load(object: ClientObject, option?: string | string[] | LoadOption): void;
/** Adds a trace message to the queue. If the promise returned by "context.sync()" is rejected due to an error, this adds a ".traceMessages" array to the OfficeExtension.Error object, containing all trace messages that were executed. These messages can help you monitor the program execution sequence and detect the cause of the error. */
trace(message: string): void;
/** Synchronizes the state between JavaScript proxy objects and the Office document, by executing instructions queued on the request context and retrieving properties of loaded Office objects for use in your code.�This method returns a promise, which is resolved when the synchronization is complete. */
sync<T>(passThroughValue?: T): IPromise<T>;
}
}
declare module OfficeExtension {
/** Contains the result for methods that return primitive types. The object's value property is retrieved from the document after "context.sync()" is invoked. */
class ClientResult<T> {
/** The value of the result that is retrieved from the document after "context.sync()" is invoked. */
value: T;
}
}
declare module OfficeExtension {
/** The error object returned by "context.sync()", if a promise is rejected due to an error while processing the request. */
class Error {
/** Error name: "OfficeExtension.Error".*/
name: string;
/** The error message passed through from the host Office application. */
message: string;
/** Stack trace, if applicable. */
stack: string;
/** Error code string, such as "InvalidArgument". */
code: string;
/** Trace messages (if any) that were added via a "context.trace()" invocation before calling "context.sync()". If there was an error, this contains all trace messages that were executed before the error occurred. These messages can help you monitor the program execution sequence and detect the case of the error. */
traceMessages: Array<string>;
/** Debug info, if applicable. The ".errorLocation" property can describe the object and method or property that caused the error. */
debugInfo: {
/** If applicable, will return the object type and the name of the method or property that caused the error. */
errorLocation?: string;
};
}
}
declare module OfficeExtension {
class ErrorCodes {
static accessDenied: string;
static generalException: string;
static activityLimitReached: string;
}
}
declare module OfficeExtension {
/** A Promise object that represents a deferred interaction with the host Office application. Promises can be chained via ".then", and errors can be caught via ".catch". Remember to always use a ".catch" on the outer promise, and to return intermediary promises so as not to break the promise chain. */
interface IPromise<R> {
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then<U>(onFulfilled?: (value: R) => IPromise<U>, onRejected?: (error: any) => IPromise<U>): IPromise<U>;
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then<U>(onFulfilled?: (value: R) => IPromise<U>, onRejected?: (error: any) => U): IPromise<U>;
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then<U>(onFulfilled?: (value: R) => IPromise<U>, onRejected?: (error: any) => void): IPromise<U>;
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => IPromise<U>): IPromise<U>;
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => U): IPromise<U>;
/**
* This method will be called once the previous promise has been resolved.
* Both the onFulfilled on onRejected callbacks are optional.
* If either or both are omitted, the next onFulfilled/onRejected in the chain will be called called.
* @returns A new promise for the value or error that was returned from onFulfilled/onRejected.
*/
then<U>(onFulfilled?: (value: R) => U, onRejected?: (error: any) => void): IPromise<U>;
/**
* Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
* @param onRejected function to be called if or when the promise rejects.
*/
catch<U>(onRejected?: (error: any) => IPromise<U>): IPromise<U>;
/**
* Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
* @param onRejected function to be called if or when the promise rejects.
*/
catch<U>(onRejected?: (error: any) => U): IPromise<U>;
/**
* Catches failures or exceptions from actions within the promise, or from an unhandled exception earlier in the call stack.
* @param onRejected function to be called if or when the promise rejects.
*/
catch<U>(onRejected?: (error: any) => void): IPromise<U>;
}
}
declare module OfficeExtension {
/** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */
class TrackedObjects {
/** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
add(object: ClientObject): void;
/** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
add(objects: ClientObject[]): void;
/** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */
remove(object: ClientObject): void;
/** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */
remove(objects: ClientObject[]): void;
}
}
declare module Office {
/**
* Returns a promise of an object described in the expression. Callback is invoked only if method fails.
* @param expression The object to be retrieved. Example "bindings#BindingName", retrieves a binding promise for a binding named 'BindingName'
* @param callback The optional callback method
*/
export function select(expression: string, callback?: (result: AsyncResult) => void): Binding;
// Enumerations
export enum ActiveView {
Read,
Edit
}
export enum BindingType {
/**
* Text based Binding
*/
Text,
/**
* Matrix based Binding
*/
Matrix,
/**
* Table based Binding
*/
Table
}
export enum CoercionType {
/**
* Coerce as Text
*/
Text,
/**
* Coerce as Matrix
*/
Matrix,
/**
* Coerce as Table
*/
Table,
/**
* Coerce as HTML
*/
Html,
/**
* Coerce as Office Open XML
*/
Ooxml,
/**
* Coerce as JSON object containing an array of the ids, titles, and indexes of the selected slides.
*/
SlideRange
}
export enum DocumentMode {
/**
* Document in Read Only Mode
*/
ReadOnly,
/**
* Document in Read/Write Mode
*/
ReadWrite
}
export enum EventType {
/**
* Occurs when the user changes the current view of the document.
*/
ActiveViewChanged,
/**
* Triggers when a binding level data change happens
*/
BindingDataChanged,
/**
* Triggers when a binding level selection happens
*/
BindingSelectionChanged,
/**
* Triggers when a document level selection happens
*/
DocumentSelectionChanged,
/**
* Triggers when a customXmlPart node was deleted
*/
NodeDeleted,
/**
* Triggers when a customXmlPart node was inserted
*/
NodeInserted,
/**
* Triggers when a customXmlPart node was replaced
*/
NodeReplaced,
/**
* Triggers when settings change in a co-Auth session.
*/
SettingsChanged,
/**
* Triggers when a Task selection happens in Project.
*/
TaskSelectionChanged,
/**
* Triggers when a Resource selection happens in Project.
*/
ResourceSelectionChanged,
/**
* Triggers when a View selection happens in Project.
*/
ViewSelectionChanged
}
export enum FileType {
/**
* Returns the file as plain text
*/
Text,
/**
* Returns the file as a byte array
*/
Compressed,
/**
* Returns the file in PDF format as a byte array
*/
Pdf
}
export enum FilterType {
/**
* Returns all items
*/
All,
/**
* Returns only visible items
*/
OnlyVisible
}
export enum GoToType {
/**
* Goes to a binding object using the specified binding id.
*/
Binding,
/**
* Goes to a named item using that item's name.
* In Excel, you can use any structured reference for a named range or table: "Worksheet2!Table1"
*/
NamedItem,
/**
* Goes to a slide using the specified id.
*/
Slide,
/**
* Goes to the specified index by slide number or enum Office.Index
*/
Index
}
export enum Index {
First,
Last,
Next,
Previous
}
export enum SelectionMode {
Default,
Selected,
None
}
export enum ValueFormat {
/**
* Returns items without format
*/
Unformatted,
/**
* Returns items with format
*/
Formatted
}
// Objects
export interface Binding {
document: Document;
/**
* Id of the Binding
*/
id: string;
type: BindingType;
/**
* Adds an event handler to the object using the specified event type.
* @param eventType The event type. For binding it can be 'bindingDataChanged' and 'bindingSelectionChanged'
* @param handler The name of the handler
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Returns the current selection.
* @param options Syntax example: {coercionType: 'matrix,'valueFormat: 'formatted', filterType:'all'}
* coercionType: The expected shape of the selection. If not specified returns the bindingType shape. Use Office.CoercionType or text value.
* valueFormat: Get data with or without format. Use Office.ValueFormat or text value.
* startRow: Used in partial get for table/matrix. Indicates the start row.
* startColumn: Used in partial get for table/matrix. Indicates the start column.
* rowCount: Used in partial get for table/matrix. Indicates the number of rows from the start row.
* columnCount: Used in partial get for table/matrix. Indicates the number of columns from the start column.
* filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value.
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getDataAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Removes an event handler from the object using the specified event type.
* @param eventType The event type. For binding can be 'bindingDataChanged' and 'bindingSelectionChanged'
* @param options Syntax example: {handler:eventHandler}
* handler: Indicates a specific handler to be removed, if not specified all handlers are removed
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Writes the specified data into the current selection.
* @param data The data to be set. Either a string or value, 2d array or TableData object
* @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'}
* coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type.
* startRow: Used in partial set for table/matrix. Indicates the start row.
* startColumn: Used in partial set for table/matrix. Indicates the start column.
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setDataAsync(data: any, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface Bindings {
document: Document;
/**
* Creates a binding against a named object in the document
* @param itemName Name of the bindable object in the document. For Example 'MyExpenses' table in Excel."
* @param bindingType The Office BindingType for the data
* @param options Syntax example: {id: "BindingID"}
* id: Name of the binding, autogenerated if not supplied.
* asyncContext: Object keeping state for the callback
* columns: The string[] of the columns involved in the binding
* @param callback The optional callback method
*/
addFromNamedItemAsync(itemName: string, bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Create a binding by prompting the user to make a selection on the document.
* @param bindingType The Office BindingType for the data
* @param options addFromPromptAsyncOptions- e.g. {promptText: "Please select data", id: "mySales"}
* promptText: Greet your users with a friendly word.
* asyncContext: Object keeping state for the callback
* id: Identifier.
* sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string.
* @param callback The optional callback method
*/
addFromPromptAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Create a binding based on what the user's current selection.
* @param bindingType The Office BindingType for the data
* @param options addFromSelectionAsyncOptions- e.g. {id: "BindingID"}
* id: Identifier.
* asyncContext: Object keeping state for the callback
* columns: The string[] of the columns involved in the binding
* sampleData: A TableData that gives sample table in the Dialog.TableData.Headers is [][] of string.
* @param callback The optional callback method
*/
addFromSelectionAsync(bindingType: BindingType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets an array with all the binding objects in the document.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getAllAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Retrieves a binding based on its Name
* @param id The binding id
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Removes the binding from the document
* @param id The binding id
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
releaseByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface Bindings {
/**
* Gets a value that indicates whether the content is in HTML or text format.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getTypeAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Adds the specified content to the beginning of the item body
* @param data The string to be inserted at the beginning of the body
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
prependAsync(data: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Replaces the selection in the body with the specified text
* @param data The string to be inserted at the beginning of the body
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setSelectedDataAsync(data: string, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface Context {
document: Document;
}
export interface CustomXmlNode {
baseName: string;
namespaceUri: string;
nodeType: string;
/**
* Gets the nodes associated with the xPath expression.
* @param xPath The xPath expression
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets the node value.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getNodeValueAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets the node's XML.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Sets the node value.
* @param value The value to be set on the node
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setNodeValueAsync(value: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Sets the node XML.
* @param xml The XML to be set on the node
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setXmlAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface CustomXmlPart {
builtIn: boolean;
id: string;
namespaceManager: CustomXmlPrefixMappings;
/**
* Adds an event handler to the object using the specified event type.
* @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced'
* @param handler The name of the handler
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addHandlerAsync(eventType: EventType, handler?: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Deletes the Custom XML Part.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
deleteAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets the nodes associated with the xPath expression.
* @param xPath The xPath expression
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets the XML for the Custom XML Part.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Removes an event handler from the object using the specified event type.
* @param eventType The event type. For CustomXmlPartNode it can be 'nodeDeleted', 'nodeInserted' or 'nodeReplaced'
* @param options Syntax example: {handler:eventHandler}
* handler: Indicates a specific handler to be removed, if not specified all handlers are removed
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface CustomXmlParts {
/**
* Asynchronously adds a new custom XML part to a file.
* @param xml The XML to add to the newly created custom XML part.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
*/
addAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Asynchronously gets the specified custom XML part by its id.
* @param id The id of the custom XML part.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
*/
getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Asynchronously gets the specified custom XML part(s) by its namespace.
* @param ns The namespace to search.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
*/
getByNamespaceAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface CustomXmlPrefixMappings {
/**
* Adds a namespace.
* @param prefix The namespace prefix
* @param ns The namespace URI
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addNamespaceAsync(prefix: string, ns: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets a namespace with the specified prefix
* @param prefix The namespace prefix
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getNamespaceAsync(prefix: string, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets a prefix for the specified URI
* @param ns The namespace URI
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getPrefixAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface Document {
bindings: Bindings;
customXmlParts: CustomXmlParts;
mode: DocumentMode;
settings: Settings;
url: string;
/**
* Adds an event handler for the specified event type.
* @param eventType The event type. For document can be 'DocumentSelectionChanged'
* @param handler The name of the handler
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Returns the current view of the presentation.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getActiveViewAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets the entire file in slices of up to 4MB.
* @param fileType The format in which the file will be returned
* @param options Syntax example: {sliceSize:1024}
* sliceSize: Specifies the desired slice size (in bytes) up to 4MB. If not specified a default slice size of 4MB will be used.
* @param callback The optional callback method
*/
getFileAsync(fileType: FileType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets file properties of the current document.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getFilePropertiesAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Returns the current selection.
* @param coercionType The expected shape of the selection.
* @param options Syntax example: {valueFormat: 'formatted', filterType:'all'}
* valueFormat: Get data with or without format. Use Office.ValueFormat or text value.
* filterType: Get the visible or all the data. Useful when filtering data. Use Office.FilterType or text value.
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getSelectedDataAsync(coercionType: CoercionType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Goes to the specified object or location in the document.
* @param id The identifier of the object or location to go to.
* @param goToType The type of the location to go to.
* @param options Syntax example: {asyncContext:context}
* selectionMode: Use Office.SelectionMode or text value.
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
goToByIdAsync(id: string, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void;
goToByIdAsync(id: number, goToType: GoToType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Removes an event handler for the specified event type.
* @param eventType The event type. For document can be 'DocumentSelectionChanged'
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* handler: The name of the handler. If not specified all handlers are removed
* @param callback The optional callback method
*/
removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Writes the specified data into the current selection.
* @param data The data to be set. Either a string or value, 2d array or TableData object
* @param options Syntax example: {coercionType:Office.CoercionType.Matrix} or {coercionType: 'matrix'}
* coercionType: Explicitly sets the shape of the data object. Use Office.CoercionType or text value. If not supplied is inferred from the data type.
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setSelectedDataAsync(data: string, options?: any, callback?: (result: AsyncResult) => void): void;
}
export interface File {
size: number;
sliceCount: number;
/**
* Closes the File.
* @param callback The optional callback method
*/
closeAsync(callback?: (result: AsyncResult) => void): void;
/**
* Gets the specified slice.
* @param sliceIndex The index of the slice to be retrieved
* @param callback The optional callback method
*/
getSliceAsync(sliceIndex: number, callback?: (result: AsyncResult) => void): void;
}
export interface FileProperties {
/**
* File's URL
*/
url: string
}
export interface MatrixBinding extends Binding {
columnCount: number;
rowCount: number;
}
export interface Settings {
/**
* Adds an event handler for the object using the specified event type.
* @param eventType The event type. For settings can be 'settingsChanged'
* @param handler The name of the handler
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Retrieves the setting with the specified name.
* @param settingName The name of the setting
*/
get(name: string): any;
/**
* Gets the latest version of the settings object.
* @param callback The optional callback method
*/
refreshAsync(callback?: (result: AsyncResult) => void): void;
/**
* Removes the setting with the specified name.
* @param settingName The name of the setting
*/
remove(name: string): void;
/**
* Removes an event handler for the specified event type.
* @param eventType The event type. For settings can be 'settingsChanged'
* @param options Syntax example: {handler:eventHandler}
* handler: Indicates a specific handler to be removed, if not specified all handlers are removed
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
removeHandlerAsync(eventType: EventType, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Saves all settings.
* @param options Syntax example: {overwriteIfStale:false}
* overwriteIfStale: Indicates whether the setting will be replaced if stale.
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
saveAsync(callback?: (result: AsyncResult) => void): void;
/**
* Sets a value for the setting with the specified name.
* @param settingName The name of the setting
* @param value The value for the setting
*/
set(name: string, value: any): void;
}
export interface Slice {
data: any;
index: number;
size: number;
}
export interface TableBinding extends Binding {
columnCount: number;
hasHeaders: boolean;
rowCount: number;
/**
* Adds the specified columns to the table
* @param tableData A TableData object with the headers and rows
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addColumnsAsync(tableData: TableData, options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Adds the specified rows to the table
* @param rows A 2D array with the rows to add
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
addRowsAsync(rows: any[][], options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Clears the table
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
deleteAllDataValuesAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Clears formatting on the bound table.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
clearFormatsAsync(options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Gets the formatting on specified items in the table.
* @param cellReference An object literal containing name-value pairs that specify the range of cells to get formatting from.
* @param formats An array specifying the format properties to get.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
getFormatsAsync(cellReference?: any, formats?: any[], options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Sets formatting on specified items and data in the table.
* @param formatsInfo Array elements are themselves three-element arrays:[target, type, formats]
* target: The identifier of the item to format. String.
* type: The kind of item to format. String.
* formats: An object literal containing a list of property name-value pairs that define the formatting to apply.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setFormatsAsync(formatsInfo?: any[][], options?: any, callback?: (result: AsyncResult) => void): void;
/**
* Updates table formatting options on the bound table.
* @param tableOptions An object literal containing a list of property name-value pairs that define the table options to apply.
* @param options Syntax example: {asyncContext:context}
* asyncContext: Object keeping state for the callback
* @param callback The optional callback method
*/
setTableOptionsAsync(tableOptions: any, options?: any, callback?: (result: AsyncResult) => void): void;
}
export class TableData {
constructor(rows: any[][], headers: any[][]);
headers: any[][];
rows: any[][];
}
export interface TextBinding extends Binding { }
export enum ProjectProjectFields {
CurrencyDigits,
CurrencySymbol,
CurrencySymbolPosition,
DurationUnits,
GUID,
Finish,
Start,
ReadOnly,
VERSION,
WorkUnits,
ProjectServerUrl,
WSSUrl,
WSSList
}
export enum ProjectResourceFields {
Accrual,
ActualCost,
ActualOvertimeCost,
ActualOvertimeWork,
ActualOvertimeWorkProtected,
ActualWork,
ActualWorkProtected,
BaseCalendar,
Baseline10BudgetCost,
Baseline10BudgetWork,
Baseline10Cost,
Baseline10Work,
Baseline1BudgetCost,
Baseline1BudgetWork,
Baseline1Cost,
Baseline1Work,
Baseline2BudgetCost,
Baseline2BudgetWork,
Baseline2Cost,
Baseline2Work,
Baseline3BudgetCost,
Baseline3BudgetWork,
Baseline3Cost,
Baseline3Work,
Baseline4BudgetCost,
Baseline4BudgetWork,
Baseline4Cost,
Baseline4Work,
Baseline5BudgetCost,
Baseline5BudgetWork,
Baseline5Cost,
Baseline5Work,
Baseline6BudgetCost,
Baseline6BudgetWork,
Baseline6Cost,
Baseline6Work,
Baseline7BudgetCost,
Baseline7BudgetWork,
Baseline7Cost,
Baseline7Work,
Baseline8BudgetCost,
Baseline8BudgetWork,
Baseline8Cost,
Baseline8Work,
Baseline9BudgetCost,
Baseline9BudgetWork,
Baseline9Cost,
Baseline9Work,
BaselineBudgetCost,
BaselineBudgetWork,
BaselineCost,
BaselineWork,
BudgetCost,
BudgetWork,
ResourceCalendarGUID,
Code,
Cost1,
Cost10,
Cost2,
Cost3,
Cost4,
Cost5,
Cost6,
Cost7,
Cost8,
Cost9,
ResourceCreationDate,
Date1,
Date10,
Date2,
Date3,
Date4,
Date5,
Date6,
Date7,
Date8,
Date9,
Duration1,
Duration10,
Duration2,
Duration3,
Duration4,
Duration5,
Duration6,
Duration7,
Duration8,
Duration9,
Email,
End,
Finish1,
Finish10,
Finish2,
Finish3,
Finish4,
Finish5,
Finish6,
Finish7,
Finish8,
Finish9,
Flag10,
Flag1,