Reputation: 151
I am trying to create a table in word document using Office Js.
I need to set the width for the two columns at 20% resp. 80%.
The table header should be formatted with a background color.
I tried using this code
var Table = body.insertTable(2, array.length, Word.InsertLocation.start, [array]);
Table.styleBuiltIn = Word.Style.GridTable1Light_Accent1
I can't find the correct properties.
The entire function
function createTable() {
Word.run(function (context) {
var body = context.document.body;
var Table = body.insertTable(2, array.length, Word.InsertLocation.start, [array]);
return context.sync();
})
.catch(errorHandler);
}
Upvotes: 2
Views: 226