I'm new to WORD ADDIN and I want to add Checkbox/DropDownList in MS WORD using Word Addin and I tried to add using Word.ContentControlType but its not helping. Can anybody tell me or provide any reference regarding it? I'm sharing my code along with the link to the official documentation of WORD ADDIN JAVASCRIPT API.
Thanks.
document.getElementById("btn-1").addEventListener("click", ()=>{
Word.run(function (context) {
var range = context.document.getSelection();
// var myContentControl = range.insertContentControl();
var myContentControl = range.insertContentControl(Word.ContentControlType.checkBox);
myContentControl.tag = 'FirstName';
myContentControl.title = 'FirstName';
myContentControl.cannotEdit = false;
// myContentControl.style = 'Heading 2';
myContentControl.insertText('');
myContentControl.appearance = Word.ContentControlAppearance.boundingBox;
context.load(myContentControl, 'id');
return context.sync().then(function () {});
});
});
https://learn.microsoft.com/en-us/javascript/api/word/word.contentcontroltype?view=word-js-preview
Thank you for reaching us! Checkbox and DropDownList content control are not supported so far by Office JS API to get or operate it. I'd recommend going to Microsoft 365 Developer Platform Ideas Forum and see if this feature has already been requested or request a new feature.