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://docs.microsoft.com/en-us/javascript/api/word/word.contentcontroltype?view=word-js-preview
Via Active questions tagged javascript - Stack Overflow https://ift.tt/ecTySWl
Comments
Post a Comment