I want to iterate through all the tables in a Word document when a user clicks on a button, and change the style of those tables to a predefined style.
Is this possible?
Word.run(function(context) {
var body = context.document.body;
context.load(body, 'table');
//iterate through tables
return context.sync();
});
The array to iterate is
But you need to load the tables first and sync before you can loop through the tables.items array. Inside your loop you can set various style* properties, font, etc. For details see Table.