-
Notifications
You must be signed in to change notification settings - Fork 61
/
word.contentcontrol.yml
1625 lines (1506 loc) · 76.7 KB
/
word.contentcontrol.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
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
### YamlMime:TSType
name: Word.ContentControl
uid: 'word!Word.ContentControl:class'
package: word!
fullName: Word.ContentControl
summary: >-
Represents a content control. Content controls are bounded and potentially labeled regions in a document that serve as
containers for specific types of content. Individual content controls may contain contents such as images, tables, or
paragraphs of formatted text. Currently, only rich text, plain text, and checkbox content controls are supported.
remarks: |-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection.
const contentControls = context.document.contentControls;
// Queue a command to load the id property for all of the content controls.
contentControls.load('id');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
if (contentControls.items.length === 0) {
console.log('No content control found.');
}
else {
// Queue a command to load the properties on the first content control.
contentControls.items[0].load( 'appearance,' +
'cannotDelete,' +
'cannotEdit,' +
'color,' +
'id,' +
'placeHolderText,' +
'removeWhenEdited,' +
'title,' +
'text,' +
'type,' +
'style,' +
'tag,' +
'font/size,' +
'font/name,' +
'font/color');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Property values of the first content control:' +
' ----- appearance: ' + contentControls.items[0].appearance +
' ----- cannotDelete: ' + contentControls.items[0].cannotDelete +
' ----- cannotEdit: ' + contentControls.items[0].cannotEdit +
' ----- color: ' + contentControls.items[0].color +
' ----- id: ' + contentControls.items[0].id +
' ----- placeHolderText: ' + contentControls.items[0].placeholderText +
' ----- removeWhenEdited: ' + contentControls.items[0].removeWhenEdited +
' ----- title: ' + contentControls.items[0].title +
' ----- text: ' + contentControls.items[0].text +
' ----- type: ' + contentControls.items[0].type +
' ----- style: ' + contentControls.items[0].style +
' ----- tag: ' + contentControls.items[0].tag +
' ----- font size: ' + contentControls.items[0].font.size +
' ----- font name: ' + contentControls.items[0].font.name +
' ----- font color: ' + contentControls.items[0].font.color);
}
});
```
isPreview: false
isDeprecated: false
type: class
properties:
- name: appearance
uid: 'word!Word.ContentControl#appearance:member'
package: word!
fullName: appearance
summary: 'Specifies the appearance of the content control. The value can be ''BoundingBox'', ''Tags'', or ''Hidden''.'
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'appearance: Word.ContentControlAppearance | "BoundingBox" | "Tags" | "Hidden";'
return:
type: '<xref uid="word!Word.ContentControlAppearance:enum" /> | "BoundingBox" | "Tags" | "Hidden"'
- name: cannotDelete
uid: 'word!Word.ContentControl#cannotDelete:member'
package: word!
fullName: cannotDelete
summary: >-
Specifies a value that indicates whether the user can delete the content control. Mutually exclusive with
removeWhenEdited.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'cannotDelete: boolean;'
return:
type: boolean
- name: cannotEdit
uid: 'word!Word.ContentControl#cannotEdit:member'
package: word!
fullName: cannotEdit
summary: Specifies a value that indicates whether the user can edit the contents of the content control.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'cannotEdit: boolean;'
return:
type: boolean
- name: color
uid: 'word!Word.ContentControl#color:member'
package: word!
fullName: color
summary: 'Specifies the color of the content control. Color is specified in ''\#RRGGBB'' format or by using the color name.'
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'color: string;'
return:
type: string
- name: contentControls
uid: 'word!Word.ContentControl#contentControls:member'
package: word!
fullName: contentControls
summary: Gets the collection of content control objects in the content control.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly contentControls: Word.ContentControlCollection;'
return:
type: '<xref uid="word!Word.ContentControlCollection:class" />'
- name: context
uid: 'word!Word.ContentControl#context:member'
package: word!
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="word!Word.RequestContext:class" />'
- name: font
uid: 'word!Word.ContentControl#font:member'
package: word!
fullName: font
summary: 'Gets the text format of the content control. Use this to get and set font name, size, color, and other properties.'
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly font: Word.Font;'
return:
type: '<xref uid="word!Word.Font:class" />'
- name: id
uid: 'word!Word.ContentControl#id:member'
package: word!
fullName: id
summary: Gets an integer that represents the content control identifier.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly id: number;'
return:
type: number
- name: inlinePictures
uid: 'word!Word.ContentControl#inlinePictures:member'
package: word!
fullName: inlinePictures
summary: >-
Gets the collection of InlinePicture objects in the content control. The collection doesn't include floating
images.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly inlinePictures: Word.InlinePictureCollection;'
return:
type: '<xref uid="word!Word.InlinePictureCollection:class" />'
- name: lists
uid: 'word!Word.ContentControl#lists:member'
package: word!
fullName: lists
summary: Gets the collection of list objects in the content control.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly lists: Word.ListCollection;'
return:
type: '<xref uid="word!Word.ListCollection:class" />'
- name: paragraphs
uid: 'word!Word.ContentControl#paragraphs:member'
package: word!
fullName: paragraphs
summary: Gets the collection of paragraph objects in the content control.
remarks: >-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
Important: For requirement sets 1.1 and 1.2, paragraphs in tables wholly contained within this content control
aren't returned. From requirement set 1.3, paragraphs in such tables are also returned.
isPreview: false
isDeprecated: false
syntax:
content: 'readonly paragraphs: Word.ParagraphCollection;'
return:
type: '<xref uid="word!Word.ParagraphCollection:class" />'
- name: parentBody
uid: 'word!Word.ContentControl#parentBody:member'
package: word!
fullName: parentBody
summary: Gets the parent body of the content control.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentBody: Word.Body;'
return:
type: '<xref uid="word!Word.Body:class" />'
- name: parentContentControl
uid: 'word!Word.ContentControl#parentContentControl:member'
package: word!
fullName: parentContentControl
summary: >-
Gets the content control that contains the content control. Throws an `ItemNotFound` error if there isn't a parent
content control.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentContentControl: Word.ContentControl;'
return:
type: '<xref uid="word!Word.ContentControl:class" />'
- name: parentContentControlOrNullObject
uid: 'word!Word.ContentControl#parentContentControlOrNullObject:member'
package: word!
fullName: parentContentControlOrNullObject
summary: >-
Gets the content control that contains the content control. If there isn't a parent content control, then this
method will return 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: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentContentControlOrNullObject: Word.ContentControl;'
return:
type: '<xref uid="word!Word.ContentControl:class" />'
- name: parentTable
uid: 'word!Word.ContentControl#parentTable:member'
package: word!
fullName: parentTable
summary: Gets the table that contains the content control. Throws an `ItemNotFound` error if it isn't contained in a table.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentTable: Word.Table;'
return:
type: '<xref uid="word!Word.Table:class" />'
- name: parentTableCell
uid: 'word!Word.ContentControl#parentTableCell:member'
package: word!
fullName: parentTableCell
summary: >-
Gets the table cell that contains the content control. Throws an `ItemNotFound` error if it isn't contained in a
table cell.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentTableCell: Word.TableCell;'
return:
type: '<xref uid="word!Word.TableCell:class" />'
- name: parentTableCellOrNullObject
uid: 'word!Word.ContentControl#parentTableCellOrNullObject:member'
package: word!
fullName: parentTableCellOrNullObject
summary: >-
Gets the table cell that contains the content control. If it isn't contained in a table cell, then this method
will return 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: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentTableCellOrNullObject: Word.TableCell;'
return:
type: '<xref uid="word!Word.TableCell:class" />'
- name: parentTableOrNullObject
uid: 'word!Word.ContentControl#parentTableOrNullObject:member'
package: word!
fullName: parentTableOrNullObject
summary: >-
Gets the table that contains the content control. If it isn't contained in a table, then this method will return
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: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly parentTableOrNullObject: Word.Table;'
return:
type: '<xref uid="word!Word.Table:class" />'
- name: placeholderText
uid: 'word!Word.ContentControl#placeholderText:member'
package: word!
fullName: placeholderText
summary: >-
Specifies the placeholder text of the content control. Dimmed text will be displayed when the content control is
empty.
Note: The set operation for this property isn't supported in Word on the web.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'placeholderText: string;'
return:
type: string
- name: removeWhenEdited
uid: 'word!Word.ContentControl#removeWhenEdited:member'
package: word!
fullName: removeWhenEdited
summary: >-
Specifies a value that indicates whether the content control is removed after it is edited. Mutually exclusive
with cannotDelete.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'removeWhenEdited: boolean;'
return:
type: boolean
- name: style
uid: 'word!Word.ContentControl#style:member'
package: word!
fullName: style
summary: >-
Specifies the style name for the content control. Use this property for custom styles and localized style names.
To use the built-in styles that are portable between locales, see the "styleBuiltIn" property.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'style: string;'
return:
type: string
- name: styleBuiltIn
uid: 'word!Word.ContentControl#styleBuiltIn:member'
package: word!
fullName: styleBuiltIn
summary: >-
Specifies the built-in style name for the content control. Use this property for built-in styles that are portable
between locales. To use custom styles or localized style names, see the "style" property.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: >-
styleBuiltIn: Word.BuiltInStyleName | "Other" | "Normal" | "Heading1" | "Heading2" | "Heading3" | "Heading4" |
"Heading5" | "Heading6" | "Heading7" | "Heading8" | "Heading9" | "Toc1" | "Toc2" | "Toc3" | "Toc4" | "Toc5" |
"Toc6" | "Toc7" | "Toc8" | "Toc9" | "FootnoteText" | "Header" | "Footer" | "Caption" | "FootnoteReference" |
"EndnoteReference" | "EndnoteText" | "Title" | "Subtitle" | "Hyperlink" | "Strong" | "Emphasis" | "NoSpacing" |
"ListParagraph" | "Quote" | "IntenseQuote" | "SubtleEmphasis" | "IntenseEmphasis" | "SubtleReference" |
"IntenseReference" | "BookTitle" | "Bibliography" | "TocHeading" | "TableGrid" | "PlainTable1" | "PlainTable2" |
"PlainTable3" | "PlainTable4" | "PlainTable5" | "TableGridLight" | "GridTable1Light" | "GridTable1Light_Accent1"
| "GridTable1Light_Accent2" | "GridTable1Light_Accent3" | "GridTable1Light_Accent4" | "GridTable1Light_Accent5"
| "GridTable1Light_Accent6" | "GridTable2" | "GridTable2_Accent1" | "GridTable2_Accent2" | "GridTable2_Accent3"
| "GridTable2_Accent4" | "GridTable2_Accent5" | "GridTable2_Accent6" | "GridTable3" | "GridTable3_Accent1" |
"GridTable3_Accent2" | "GridTable3_Accent3" | "GridTable3_Accent4" | "GridTable3_Accent5" | "GridTable3_Accent6"
| "GridTable4" | "GridTable4_Accent1" | "GridTable4_Accent2" | "GridTable4_Accent3" | "GridTable4_Accent4" |
"GridTable4_Accent5" | "GridTable4_Accent6" | "GridTable5Dark" | "GridTable5Dark_Accent1" |
"GridTable5Dark_Accent2" | "GridTable5Dark_Accent3" | "GridTable5Dark_Accent4" | "GridTable5Dark_Accent5" |
"GridTable5Dark_Accent6" | "GridTable6Colorful" | "GridTable6Colorful_Accent1" | "GridTable6Colorful_Accent2" |
"GridTable6Colorful_Accent3" | "GridTable6Colorful_Accent4" | "GridTable6Colorful_Accent5" |
"GridTable6Colorful_Accent6" | "GridTable7Colorful" | "GridTable7Colorful_Accent1" |
"GridTable7Colorful_Accent2" | "GridTable7Colorful_Accent3" | "GridTable7Colorful_Accent4" |
"GridTable7Colorful_Accent5" | "GridTable7Colorful_Accent6" | "ListTable1Light" | "ListTable1Light_Accent1" |
"ListTable1Light_Accent2" | "ListTable1Light_Accent3" | "ListTable1Light_Accent4" | "ListTable1Light_Accent5" |
"ListTable1Light_Accent6" | "ListTable2" | "ListTable2_Accent1" | "ListTable2_Accent2" | "ListTable2_Accent3" |
"ListTable2_Accent4" | "ListTable2_Accent5" | "ListTable2_Accent6" | "ListTable3" | "ListTable3_Accent1" |
"ListTable3_Accent2" | "ListTable3_Accent3" | "ListTable3_Accent4" | "ListTable3_Accent5" | "ListTable3_Accent6"
| "ListTable4" | "ListTable4_Accent1" | "ListTable4_Accent2" | "ListTable4_Accent3" | "ListTable4_Accent4" |
"ListTable4_Accent5" | "ListTable4_Accent6" | "ListTable5Dark" | "ListTable5Dark_Accent1" |
"ListTable5Dark_Accent2" | "ListTable5Dark_Accent3" | "ListTable5Dark_Accent4" | "ListTable5Dark_Accent5" |
"ListTable5Dark_Accent6" | "ListTable6Colorful" | "ListTable6Colorful_Accent1" | "ListTable6Colorful_Accent2" |
"ListTable6Colorful_Accent3" | "ListTable6Colorful_Accent4" | "ListTable6Colorful_Accent5" |
"ListTable6Colorful_Accent6" | "ListTable7Colorful" | "ListTable7Colorful_Accent1" |
"ListTable7Colorful_Accent2" | "ListTable7Colorful_Accent3" | "ListTable7Colorful_Accent4" |
"ListTable7Colorful_Accent5" | "ListTable7Colorful_Accent6";
return:
type: >-
<xref uid="word!Word.BuiltInStyleName:enum" /> | "Other" | "Normal" | "Heading1" | "Heading2" | "Heading3" |
"Heading4" | "Heading5" | "Heading6" | "Heading7" | "Heading8" | "Heading9" | "Toc1" | "Toc2" | "Toc3" |
"Toc4" | "Toc5" | "Toc6" | "Toc7" | "Toc8" | "Toc9" | "FootnoteText" | "Header" | "Footer" | "Caption" |
"FootnoteReference" | "EndnoteReference" | "EndnoteText" | "Title" | "Subtitle" | "Hyperlink" | "Strong" |
"Emphasis" | "NoSpacing" | "ListParagraph" | "Quote" | "IntenseQuote" | "SubtleEmphasis" | "IntenseEmphasis" |
"SubtleReference" | "IntenseReference" | "BookTitle" | "Bibliography" | "TocHeading" | "TableGrid" |
"PlainTable1" | "PlainTable2" | "PlainTable3" | "PlainTable4" | "PlainTable5" | "TableGridLight" |
"GridTable1Light" | "GridTable1Light_Accent1" | "GridTable1Light_Accent2" | "GridTable1Light_Accent3" |
"GridTable1Light_Accent4" | "GridTable1Light_Accent5" | "GridTable1Light_Accent6" | "GridTable2" |
"GridTable2_Accent1" | "GridTable2_Accent2" | "GridTable2_Accent3" | "GridTable2_Accent4" |
"GridTable2_Accent5" | "GridTable2_Accent6" | "GridTable3" | "GridTable3_Accent1" | "GridTable3_Accent2" |
"GridTable3_Accent3" | "GridTable3_Accent4" | "GridTable3_Accent5" | "GridTable3_Accent6" | "GridTable4" |
"GridTable4_Accent1" | "GridTable4_Accent2" | "GridTable4_Accent3" | "GridTable4_Accent4" |
"GridTable4_Accent5" | "GridTable4_Accent6" | "GridTable5Dark" | "GridTable5Dark_Accent1" |
"GridTable5Dark_Accent2" | "GridTable5Dark_Accent3" | "GridTable5Dark_Accent4" | "GridTable5Dark_Accent5" |
"GridTable5Dark_Accent6" | "GridTable6Colorful" | "GridTable6Colorful_Accent1" | "GridTable6Colorful_Accent2"
| "GridTable6Colorful_Accent3" | "GridTable6Colorful_Accent4" | "GridTable6Colorful_Accent5" |
"GridTable6Colorful_Accent6" | "GridTable7Colorful" | "GridTable7Colorful_Accent1" |
"GridTable7Colorful_Accent2" | "GridTable7Colorful_Accent3" | "GridTable7Colorful_Accent4" |
"GridTable7Colorful_Accent5" | "GridTable7Colorful_Accent6" | "ListTable1Light" | "ListTable1Light_Accent1" |
"ListTable1Light_Accent2" | "ListTable1Light_Accent3" | "ListTable1Light_Accent4" | "ListTable1Light_Accent5"
| "ListTable1Light_Accent6" | "ListTable2" | "ListTable2_Accent1" | "ListTable2_Accent2" |
"ListTable2_Accent3" | "ListTable2_Accent4" | "ListTable2_Accent5" | "ListTable2_Accent6" | "ListTable3" |
"ListTable3_Accent1" | "ListTable3_Accent2" | "ListTable3_Accent3" | "ListTable3_Accent4" |
"ListTable3_Accent5" | "ListTable3_Accent6" | "ListTable4" | "ListTable4_Accent1" | "ListTable4_Accent2" |
"ListTable4_Accent3" | "ListTable4_Accent4" | "ListTable4_Accent5" | "ListTable4_Accent6" | "ListTable5Dark" |
"ListTable5Dark_Accent1" | "ListTable5Dark_Accent2" | "ListTable5Dark_Accent3" | "ListTable5Dark_Accent4" |
"ListTable5Dark_Accent5" | "ListTable5Dark_Accent6" | "ListTable6Colorful" | "ListTable6Colorful_Accent1" |
"ListTable6Colorful_Accent2" | "ListTable6Colorful_Accent3" | "ListTable6Colorful_Accent4" |
"ListTable6Colorful_Accent5" | "ListTable6Colorful_Accent6" | "ListTable7Colorful" |
"ListTable7Colorful_Accent1" | "ListTable7Colorful_Accent2" | "ListTable7Colorful_Accent3" |
"ListTable7Colorful_Accent4" | "ListTable7Colorful_Accent5" | "ListTable7Colorful_Accent6"
- name: subtype
uid: 'word!Word.ContentControl#subtype:member'
package: word!
fullName: subtype
summary: >-
Gets the content control subtype. The subtype can be 'RichTextInline', 'RichTextParagraphs', 'RichTextTableCell',
'RichTextTableRow' and 'RichTextTable' for rich text content controls, or 'PlainTextInline' and
'PlainTextParagraph' for plain text content controls, or 'CheckBox' for checkbox content controls.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: >-
readonly subtype: Word.ContentControlType | "Unknown" | "RichTextInline" | "RichTextParagraphs" |
"RichTextTableCell" | "RichTextTableRow" | "RichTextTable" | "PlainTextInline" | "PlainTextParagraph" |
"Picture" | "BuildingBlockGallery" | "CheckBox" | "ComboBox" | "DropDownList" | "DatePicker" |
"RepeatingSection" | "RichText" | "PlainText";
return:
type: >-
<xref uid="word!Word.ContentControlType:enum" /> | "Unknown" | "RichTextInline" | "RichTextParagraphs" |
"RichTextTableCell" | "RichTextTableRow" | "RichTextTable" | "PlainTextInline" | "PlainTextParagraph" |
"Picture" | "BuildingBlockGallery" | "CheckBox" | "ComboBox" | "DropDownList" | "DatePicker" |
"RepeatingSection" | "RichText" | "PlainText"
- name: tables
uid: 'word!Word.ContentControl#tables:member'
package: word!
fullName: tables
summary: Gets the collection of table objects in the content control.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly tables: Word.TableCollection;'
return:
type: '<xref uid="word!Word.TableCollection:class" />'
- name: tag
uid: 'word!Word.ContentControl#tag:member'
package: word!
fullName: tag
summary: Specifies a tag to identify a content control.
remarks: >-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/10-content-controls/insert-and-change-content-controls.yaml
// Traverses each paragraph of the document and wraps a content control on each with either a even or odd tags.
await Word.run(async (context) => {
let paragraphs = context.document.body.paragraphs;
paragraphs.load("$none"); // Don't need any properties; just wrap each paragraph with a content control.
await context.sync();
for (let i = 0; i < paragraphs.items.length; i++) {
let contentControl = paragraphs.items[i].insertContentControl();
// For even, tag "even".
if (i % 2 === 0) {
contentControl.tag = "even";
} else {
contentControl.tag = "odd";
}
}
console.log("Content controls inserted: " + paragraphs.items.length);
await context.sync();
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'tag: string;'
return:
type: string
- name: text
uid: 'word!Word.ContentControl#text:member'
package: word!
fullName: text
summary: Gets the text of the content control.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'readonly text: string;'
return:
type: string
- name: title
uid: 'word!Word.ContentControl#title:member'
package: word!
fullName: title
summary: Specifies the title for a content control.
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'title: string;'
return:
type: string
- name: type
uid: 'word!Word.ContentControl#type:member'
package: word!
fullName: type
summary: 'Gets the content control type. Only rich text, plain text, and checkbox content controls are supported currently.'
remarks: '\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: >-
readonly type: Word.ContentControlType | "Unknown" | "RichTextInline" | "RichTextParagraphs" |
"RichTextTableCell" | "RichTextTableRow" | "RichTextTable" | "PlainTextInline" | "PlainTextParagraph" |
"Picture" | "BuildingBlockGallery" | "CheckBox" | "ComboBox" | "DropDownList" | "DatePicker" |
"RepeatingSection" | "RichText" | "PlainText";
return:
type: >-
<xref uid="word!Word.ContentControlType:enum" /> | "Unknown" | "RichTextInline" | "RichTextParagraphs" |
"RichTextTableCell" | "RichTextTableRow" | "RichTextTable" | "PlainTextInline" | "PlainTextParagraph" |
"Picture" | "BuildingBlockGallery" | "CheckBox" | "ComboBox" | "DropDownList" | "DatePicker" |
"RepeatingSection" | "RichText" | "PlainText"
methods:
- name: clear()
uid: 'word!Word.ContentControl#clear:member(1)'
package: word!
fullName: clear()
summary: Clears the contents of the content control. The user can perform the undo operation on the cleared content.
remarks: |-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection.
const contentControls = context.document.contentControls;
// Queue a command to load the content controls collection.
contentControls.load('text');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
if (contentControls.items.length === 0) {
console.log("There isn't a content control in this document.");
} else {
// Queue a command to clear the contents of the first content control.
contentControls.items[0].clear();
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Content control cleared of contents.');
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'clear(): void;'
return:
type: void
description: ''
- name: delete(keepContent)
uid: 'word!Word.ContentControl#delete:member(1)'
package: word!
fullName: delete(keepContent)
summary: 'Deletes the content control and its content. If `keepContent` is set to true, the content isn''t deleted.'
remarks: >-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection.
const contentControls = context.document.contentControls;
// Queue a command to load the content controls collection.
contentControls.load('text');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
if (contentControls.items.length === 0) {
console.log("There isn't a content control in this document.");
} else {
// Queue a command to delete the first content control.
// The contents will remain in the document.
contentControls.items[0].delete(true);
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Content control cleared of contents.');
}
});
```
```TypeScript
// Link to full sample:
https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/10-content-controls/content-control-ondeleted-event.yaml
await Word.run(async (context) => {
const contentControls = context.document.contentControls.getByTag("forTesting");
contentControls.load("items");
await context.sync();
if (contentControls.items.length === 0) {
console.log("There are no content controls in this document.");
} else {
console.log("Control to be deleted:", contentControls.items[0]);
contentControls.items[0].delete(false);
await context.sync();
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'delete(keepContent: boolean): void;'
parameters:
- id: keepContent
description: >-
Required. Indicates whether the content should be deleted with the content control. If `keepContent` is set
to true, the content isn't deleted.
type: boolean
return:
type: void
description: ''
- name: getHtml()
uid: 'word!Word.ContentControl#getHtml:member(1)'
package: word!
fullName: getHtml()
summary: >-
Gets an HTML representation of the content control object. When rendered in a web page or HTML viewer, the
formatting will be a close, but not exact, match for of the formatting of the document. This method doesn't return
the exact same HTML for the same document on different platforms (Windows, Mac, Word on the web, etc.). If you
need exact fidelity, or consistency across platforms, use `ContentControl.getOoxml()` and convert the returned XML
to HTML.
remarks: |-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection that contains a specific tag.
const contentControlsWithTag = context.document.contentControls.getByTag('Customer-Address');
// Queue a command to load the tag property for all of content controls.
contentControlsWithTag.load('tag');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
if (contentControlsWithTag.items.length === 0) {
console.log('No content control found.');
}
else {
// Queue a command to get the HTML contents of the first content control.
const html = contentControlsWithTag.items[0].getHtml();
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Content control HTML: ' + html.value);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'getHtml(): OfficeExtension.ClientResult<string>;'
return:
type: '<xref uid="office!OfficeExtension.ClientResult:class" /><string>'
description: ''
- name: getOoxml()
uid: 'word!Word.ContentControl#getOoxml:member(1)'
package: word!
fullName: getOoxml()
summary: Gets the Office Open XML (OOXML) representation of the content control object.
remarks: |-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection.
const contentControls = context.document.contentControls;
// Queue a command to load the id property for all of the content controls.
contentControls.load('id');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
if (contentControls.items.length === 0) {
console.log('No content control found.');
}
else {
// Queue a command to get the OOXML contents of the first content control.
const ooxml = contentControls.items[0].getOoxml();
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Content control OOXML: ' + ooxml.value);
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: 'getOoxml(): OfficeExtension.ClientResult<string>;'
return:
type: '<xref uid="office!OfficeExtension.ClientResult:class" /><string>'
description: ''
- name: getRange(rangeLocation)
uid: 'word!Word.ContentControl#getRange:member(1)'
package: word!
fullName: getRange(rangeLocation)
summary: 'Gets the whole content control, or the starting or ending point of the content control, as a range.'
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: >-
getRange(rangeLocation?: Word.RangeLocation | "Whole" | "Start" | "End" | "Before" | "After" | "Content"):
Word.Range;
parameters:
- id: rangeLocation
description: 'Optional. The range location must be ''Whole'', ''Start'', ''End'', ''Before'', ''After'', or ''Content''.'
type: '<xref uid="word!Word.RangeLocation:enum" /> | "Whole" | "Start" | "End" | "Before" | "After" | "Content"'
return:
type: '<xref uid="word!Word.Range:class" />'
description: ''
- name: 'getTextRanges(endingMarks, trimSpacing)'
uid: 'word!Word.ContentControl#getTextRanges:member(1)'
package: word!
fullName: 'getTextRanges(endingMarks, trimSpacing)'
summary: Gets the text ranges in the content control by using punctuation marks and/or other ending marks.
remarks: '\[ [API set: WordApi 1.3](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: 'getTextRanges(endingMarks: string[], trimSpacing?: boolean): Word.RangeCollection;'
parameters:
- id: endingMarks
description: Required. The punctuation marks and/or other ending marks as an array of strings.
type: 'string[]'
- id: trimSpacing
description: >-
Optional. Indicates whether to trim spacing characters (spaces, tabs, column breaks, and paragraph end
marks) from the start and end of the ranges returned in the range collection. Default is false which
indicates that spacing characters at the start and end of the ranges are included in the range collection.
type: boolean
return:
type: '<xref uid="word!Word.RangeCollection:class" />'
description: ''
- name: 'insertBreak(breakType, insertLocation)'
uid: 'word!Word.ContentControl#insertBreak:member(1)'
package: word!
fullName: 'insertBreak(breakType, insertLocation)'
summary: >-
Inserts a break at the specified location in the main document. This method cannot be used with 'RichTextTable',
'RichTextTableRow' and 'RichTextTableCell' content controls.
remarks: |-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection.
const contentControls = context.document.contentControls;
// Queue a command to load the id property for all of content controls.
contentControls.load('id');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
// We now will have access to the content control collection.
await context.sync();
if (contentControls.items.length === 0) {
console.log('No content control found.');
}
else {
// Queue a command to insert a page break after the first content control.
contentControls.items[0].insertBreak(Word.BreakType.page, Word.InsertLocation.after);
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Inserted a page break after the first content control.');
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: >-
insertBreak(breakType: Word.BreakType | "Page" | "Next" | "SectionNext" | "SectionContinuous" | "SectionEven" |
"SectionOdd" | "Line", insertLocation: Word.InsertLocation.start | Word.InsertLocation.end |
Word.InsertLocation.before | Word.InsertLocation.after | "Start" | "End" | "Before" | "After"): void;
parameters:
- id: breakType
description: Required. Type of break.
type: >-
<xref uid="word!Word.BreakType:enum" /> | "Page" | "Next" | "SectionNext" | "SectionContinuous" |
"SectionEven" | "SectionOdd" | "Line"
- id: insertLocation
description: 'Required. The value must be ''Start'', ''End'', ''Before'', or ''After''.'
type: >-
<xref uid="word!Word.InsertLocation.start:member" /> | <xref uid="word!Word.InsertLocation.end:member" /> |
<xref uid="word!Word.InsertLocation.before:member" /> | <xref uid="word!Word.InsertLocation.after:member" />
| "Start" | "End" | "Before" | "After"
return:
type: void
description: ''
- name: 'insertFileFromBase64(base64File, insertLocation)'
uid: 'word!Word.ContentControl#insertFileFromBase64:member(1)'
package: word!
fullName: 'insertFileFromBase64(base64File, insertLocation)'
summary: Inserts a document into the content control at the specified location.
remarks: >-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
Note: Insertion isn't supported if the document being inserted contains an ActiveX control (likely in a form
field). Consider replacing such a form field with a content control or other option appropriate for your scenario.
isPreview: false
isDeprecated: false
syntax:
content: >-
insertFileFromBase64(base64File: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start
| Word.InsertLocation.end | "Replace" | "Start" | "End"): Word.Range;
parameters:
- id: base64File
description: Required. The Base64-encoded content of a .docx file.
type: string
- id: insertLocation
description: >-
Required. The value must be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and
'RichTextTableRow' content controls.
type: >-
<xref uid="word!Word.InsertLocation.replace:member" /> | <xref uid="word!Word.InsertLocation.start:member"
/> | <xref uid="word!Word.InsertLocation.end:member" /> | "Replace" | "Start" | "End"
return:
type: '<xref uid="word!Word.Range:class" />'
description: ''
- name: 'insertHtml(html, insertLocation)'
uid: 'word!Word.ContentControl#insertHtml:member(1)'
package: word!
fullName: 'insertHtml(html, insertLocation)'
summary: Inserts HTML into the content control at the specified location.
remarks: |-
\[ [API set: WordApi 1.1](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]
#### Examples
```TypeScript
// Run a batch operation against the Word object model.
await Word.run(async (context) => {
// Create a proxy object for the content controls collection.
const contentControls = context.document.contentControls;
// Queue a command to load the id property for all of the content controls.
contentControls.load('id');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
if (contentControls.items.length === 0) {
console.log('No content control found.');
}
else {
// Queue a command to put HTML into the contents of the first content control.
contentControls.items[0].insertHtml(
'<strong>HTML content inserted into the content control.</strong>',
'Start');
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
await context.sync();
console.log('Inserted HTML in the first content control.');
}
});
```
isPreview: false
isDeprecated: false
syntax:
content: >-
insertHtml(html: string, insertLocation: Word.InsertLocation.replace | Word.InsertLocation.start |
Word.InsertLocation.end | "Replace" | "Start" | "End"): Word.Range;
parameters:
- id: html
description: Required. The HTML to be inserted in to the content control.
type: string
- id: insertLocation
description: >-
Required. The value must be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and
'RichTextTableRow' content controls.
type: >-
<xref uid="word!Word.InsertLocation.replace:member" /> | <xref uid="word!Word.InsertLocation.start:member"
/> | <xref uid="word!Word.InsertLocation.end:member" /> | "Replace" | "Start" | "End"
return:
type: '<xref uid="word!Word.Range:class" />'
description: ''
- name: 'insertInlinePictureFromBase64(base64EncodedImage, insertLocation)'
uid: 'word!Word.ContentControl#insertInlinePictureFromBase64:member(1)'
package: word!
fullName: 'insertInlinePictureFromBase64(base64EncodedImage, insertLocation)'
summary: Inserts an inline picture into the content control at the specified location.
remarks: '\[ [API set: WordApi 1.2](/javascript/api/requirement-sets/word/word-api-requirement-sets) \]'
isPreview: false
isDeprecated: false
syntax:
content: >-
insertInlinePictureFromBase64(base64EncodedImage: string, insertLocation: Word.InsertLocation.replace |
Word.InsertLocation.start | Word.InsertLocation.end | "Replace" | "Start" | "End"): Word.InlinePicture;
parameters:
- id: base64EncodedImage
description: Required. The Base64-encoded image to be inserted in the content control.
type: string
- id: insertLocation
description: >-
Required. The value must be 'Replace', 'Start', or 'End'. 'Replace' cannot be used with 'RichTextTable' and
'RichTextTableRow' content controls.
type: >-
<xref uid="word!Word.InsertLocation.replace:member" /> | <xref uid="word!Word.InsertLocation.start:member"