0
我想使用office js word api在word中添加內容控件。我正在使用insertContentControl方法,但此方法不在文檔末尾或特定插入位置添加。 下面是我的代碼: -在word中使用office js word api插入內容控件
Word.run(function (context) {
var body = context.document.body;
var contents = body.contentControls;
// Queue a commmand to wrap the body in a content control.
var a = body.insertContentControl();
a.appearance = "name";
a.tag = "name1";
a.title = "name";
return context.sync().then(function() {
// context.load(body);
console.log('Wrapped the body in a content control.');
});
})
.catch(function (error) {
console.log('Error: ' + JSON.stringify(error));
if (error instanceof OfficeExtension.Error) {
console.log('Debug info: ' + JSON.stringify(error.debugInfo));
}
});
而且我要的屬性添加到它一樣的外觀,標籤,標題爲新的內容控件創建