Я пытаюсь вставить таблицу с помощью Office.js в тело документа, но безрезультатно.
Я использовал следующий код:
function insertSampleTable() {
showNotification("Insert Table", "Inserting table...")
Word.run(function (context) {
// Create a proxy object for the document body.
var body = context.document.body;
body.insertTable(2, 2, Word.InsertLocation.end, ["a"]);
// Synchronize the document state by executing the queued commands, and return a promise to indicate task completion.
return context.sync();
})
.catch(errorHandler);
}
Но при нажатии на кнопку выдает следующую ошибку:
Error: TypeError: Object doesn't support property or method 'insertTable'
Любая помощь будет оценена. Я попытался проверить сайт Microsoft Office Dev, но у них нет подобных образцов.
Спасибо!