@@ -16980,6 +16980,101 @@
1698016980 await Word.run(async (context) => {
1698116981 context.document.close(Word.CloseBehavior.save);
1698216982 });
16983+ 'Word.ComboBoxContentControl:class':
16984+ - >-
16985+ // Link to full sample:
16986+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-combo-box-content-control.yaml
16987+
16988+
16989+ // Places a combo box content control at the end of the selection.
16990+
16991+ await Word.run(async (context) => {
16992+ let selection = context.document.getSelection();
16993+ selection.getRange(Word.RangeLocation.end).insertContentControl(Word.ContentControlType.comboBox);
16994+ await context.sync();
16995+
16996+ console.log("Combo box content control inserted at the end of the selection.");
16997+ });
16998+ 'Word.ComboBoxContentControl#addListItem:member(1)':
16999+ - >-
17000+ // Link to full sample:
17001+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-combo-box-content-control.yaml
17002+
17003+
17004+ // Adds the provided list item to the first combo box content control in the
17005+ selection.
17006+
17007+ await Word.run(async (context) => {
17008+ const listItem = $("#item-to-add")
17009+ .val()
17010+ .toString()
17011+ .trim();
17012+ const selectedRange: Word.Range = context.document.getSelection();
17013+ let selectedContentControl = selectedRange
17014+ .getContentControls({
17015+ types: [Word.ContentControlType.comboBox]
17016+ })
17017+ .getFirstOrNullObject();
17018+ selectedContentControl.load("id,comboBoxContentControl");
17019+
17020+ await context.sync();
17021+
17022+ if (selectedContentControl.isNullObject) {
17023+ const parentContentControl: Word.ContentControl = selectedRange.parentContentControl;
17024+ parentContentControl.load("id,type,comboBoxContentControl");
17025+ await context.sync();
17026+
17027+ if (parentContentControl.isNullObject || parentContentControl.type !== Word.ContentControlType.comboBox) {
17028+ console.warn("No combo box content control is currently selected.");
17029+ return;
17030+ } else {
17031+ selectedContentControl = parentContentControl;
17032+ }
17033+ }
17034+
17035+ selectedContentControl.comboBoxContentControl.addListItem(listItem);
17036+ await context.sync();
17037+
17038+ console.log(`List item ${listItem} added to control with ID: ${selectedContentControl.id}`);
17039+ });
17040+ 'Word.ComboBoxContentControl#deleteAllListItems:member(1)':
17041+ - >-
17042+ // Link to full sample:
17043+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-combo-box-content-control.yaml
17044+
17045+
17046+ // Deletes the list items from first combo box content control found in the
17047+ selection.
17048+
17049+ await Word.run(async (context) => {
17050+ const selectedRange: Word.Range = context.document.getSelection();
17051+ let selectedContentControl = selectedRange
17052+ .getContentControls({
17053+ types: [Word.ContentControlType.comboBox]
17054+ })
17055+ .getFirstOrNullObject();
17056+ selectedContentControl.load("id,comboBoxContentControl");
17057+ await context.sync();
17058+
17059+ if (selectedContentControl.isNullObject) {
17060+ const parentContentControl: Word.ContentControl = selectedRange.parentContentControl;
17061+ parentContentControl.load("id,type,comboBoxContentControl");
17062+ await context.sync();
17063+
17064+ if (parentContentControl.isNullObject || parentContentControl.type !== Word.ContentControlType.comboBox) {
17065+ console.warn("No combo box content control is currently selected.");
17066+ return;
17067+ } else {
17068+ selectedContentControl = parentContentControl;
17069+ }
17070+ }
17071+
17072+ console.log(`About to delete the list from the combo box content control with ID: ${selectedContentControl.id}`);
17073+ selectedContentControl.comboBoxContentControl.deleteAllListItems();
17074+ await context.sync();
17075+
17076+ console.log("Deleted the list from the combo box content control.");
17077+ });
1698317078'Word.Comment:class':
1698417079 - >-
1698517080 // Link to full sample:
1752117616 `id: ${selectedContentControl.id} ... isChecked: ${selectedContentControl.checkboxContentControl.isChecked}`
1752217617 );
1752317618 });
17619+ 'Word.ContentControl#comboBoxContentControl:member':
17620+ - >-
17621+ // Link to full sample:
17622+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-combo-box-content-control.yaml
17623+
17624+
17625+ // Adds the provided list item to the first combo box content control in the
17626+ selection.
17627+
17628+ await Word.run(async (context) => {
17629+ const listItem = $("#item-to-add")
17630+ .val()
17631+ .toString()
17632+ .trim();
17633+ const selectedRange: Word.Range = context.document.getSelection();
17634+ let selectedContentControl = selectedRange
17635+ .getContentControls({
17636+ types: [Word.ContentControlType.comboBox]
17637+ })
17638+ .getFirstOrNullObject();
17639+ selectedContentControl.load("id,comboBoxContentControl");
17640+
17641+ await context.sync();
17642+
17643+ if (selectedContentControl.isNullObject) {
17644+ const parentContentControl: Word.ContentControl = selectedRange.parentContentControl;
17645+ parentContentControl.load("id,type,comboBoxContentControl");
17646+ await context.sync();
17647+
17648+ if (parentContentControl.isNullObject || parentContentControl.type !== Word.ContentControlType.comboBox) {
17649+ console.warn("No combo box content control is currently selected.");
17650+ return;
17651+ } else {
17652+ selectedContentControl = parentContentControl;
17653+ }
17654+ }
17655+
17656+ selectedContentControl.comboBoxContentControl.addListItem(listItem);
17657+ await context.sync();
17658+
17659+ console.log(`List item ${listItem} added to control with ID: ${selectedContentControl.id}`);
17660+ });
17661+ 'Word.ContentControl#dropDownListContentControl:member':
17662+ - >-
17663+ // Link to full sample:
17664+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-dropdown-list-content-control.yaml
17665+
17666+
17667+ // Adds the provided list item to the first dropdown list content control in
17668+ the selection.
17669+
17670+ await Word.run(async (context) => {
17671+ const listItem = $("#item-to-add")
17672+ .val()
17673+ .toString()
17674+ .trim();
17675+ const selectedRange: Word.Range = context.document.getSelection();
17676+ let selectedContentControl = selectedRange
17677+ .getContentControls({
17678+ types: [Word.ContentControlType.dropDownList]
17679+ })
17680+ .getFirstOrNullObject();
17681+ selectedContentControl.load("id,dropDownListContentControl");
17682+
17683+ await context.sync();
17684+
17685+ if (selectedContentControl.isNullObject) {
17686+ const parentContentControl: Word.ContentControl = selectedRange.parentContentControl;
17687+ parentContentControl.load("id,type,dropDownListContentControl");
17688+ await context.sync();
17689+
17690+ if (parentContentControl.isNullObject || parentContentControl.type !== Word.ContentControlType.dropDownList) {
17691+ console.warn("No dropdown list content control is currently selected.");
17692+ return;
17693+ } else {
17694+ selectedContentControl = parentContentControl;
17695+ }
17696+ }
17697+
17698+ selectedContentControl.dropDownListContentControl.addListItem(listItem);
17699+ await context.sync();
17700+
17701+ console.log(`List item ${listItem} added to control with ID: ${selectedContentControl.id}`);
17702+ });
1752417703'Word.ContentControl#onDataChanged:member':
1752517704 - >-
1752617705 // Link to full sample:
@@ -19495,6 +19674,103 @@
1949519674 for (let i = 0; i < properties.items.length; i++)
1949619675 console.log("Property Name:" + properties.items[i].key + "; Type=" + properties.items[i].type + "; Property Value=" + properties.items[i].value);
1949719676 });
19677+ 'Word.DropDownListContentControl:class':
19678+ - >-
19679+ // Link to full sample:
19680+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-dropdown-list-content-control.yaml
19681+
19682+
19683+ // Places a dropdown list content control at the end of the selection.
19684+
19685+ await Word.run(async (context) => {
19686+ let selection = context.document.getSelection();
19687+ selection.getRange(Word.RangeLocation.end).insertContentControl(Word.ContentControlType.dropDownList);
19688+ await context.sync();
19689+
19690+ console.log("Dropdown list content control inserted at the end of the selection.");
19691+ });
19692+ 'Word.DropDownListContentControl#addListItem:member(1)':
19693+ - >-
19694+ // Link to full sample:
19695+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-dropdown-list-content-control.yaml
19696+
19697+
19698+ // Adds the provided list item to the first dropdown list content control in
19699+ the selection.
19700+
19701+ await Word.run(async (context) => {
19702+ const listItem = $("#item-to-add")
19703+ .val()
19704+ .toString()
19705+ .trim();
19706+ const selectedRange: Word.Range = context.document.getSelection();
19707+ let selectedContentControl = selectedRange
19708+ .getContentControls({
19709+ types: [Word.ContentControlType.dropDownList]
19710+ })
19711+ .getFirstOrNullObject();
19712+ selectedContentControl.load("id,dropDownListContentControl");
19713+
19714+ await context.sync();
19715+
19716+ if (selectedContentControl.isNullObject) {
19717+ const parentContentControl: Word.ContentControl = selectedRange.parentContentControl;
19718+ parentContentControl.load("id,type,dropDownListContentControl");
19719+ await context.sync();
19720+
19721+ if (parentContentControl.isNullObject || parentContentControl.type !== Word.ContentControlType.dropDownList) {
19722+ console.warn("No dropdown list content control is currently selected.");
19723+ return;
19724+ } else {
19725+ selectedContentControl = parentContentControl;
19726+ }
19727+ }
19728+
19729+ selectedContentControl.dropDownListContentControl.addListItem(listItem);
19730+ await context.sync();
19731+
19732+ console.log(`List item ${listItem} added to control with ID: ${selectedContentControl.id}`);
19733+ });
19734+ 'Word.DropDownListContentControl#deleteAllListItems:member(1)':
19735+ - >-
19736+ // Link to full sample:
19737+ https://raw.githubusercontent.com/OfficeDev/office-js-snippets/prod/samples/word/99-preview-apis/insert-and-change-dropdown-list-content-control.yaml
19738+
19739+
19740+ // Deletes the list items from first dropdown list content control found in
19741+ the selection.
19742+
19743+ await Word.run(async (context) => {
19744+ const selectedRange: Word.Range = context.document.getSelection();
19745+ let selectedContentControl = selectedRange
19746+ .getContentControls({
19747+ types: [Word.ContentControlType.dropDownList]
19748+ })
19749+ .getFirstOrNullObject();
19750+ selectedContentControl.load("id,dropDownListContentControl");
19751+ await context.sync();
19752+
19753+ if (selectedContentControl.isNullObject) {
19754+ const parentContentControl: Word.ContentControl = selectedRange.parentContentControl;
19755+ parentContentControl.load("id,type,dropDownListContentControl");
19756+ await context.sync();
19757+
19758+ if (parentContentControl.isNullObject || parentContentControl.type !== Word.ContentControlType.dropDownList) {
19759+ console.warn("No dropdown list content control is currently selected.");
19760+ return;
19761+ } else {
19762+ selectedContentControl = parentContentControl;
19763+ }
19764+ }
19765+
19766+ console.log(
19767+ `About to delete the list from the dropdown list content control with ID: ${selectedContentControl.id}`
19768+ );
19769+ selectedContentControl.dropDownListContentControl.deleteAllListItems();
19770+ await context.sync();
19771+
19772+ console.log("Deleted the list from the dropdown list content control.");
19773+ });
1949819774'Word.ErrorCodes:enum':
1949919775 - >-
1950019776 // Link to full sample:
0 commit comments