Reputation: 379
Am using Office 365 to create excel addins. Noticed that the table which we create in Excel using office js gets created with a default style. Any other table style you apply , gets applied on top of that. So while the table is rendering, you get to see that flick in which the table style changes from the default one to the new style you apply while creating the table. Is there any way we can avoid having the default style in the Excel table?
Upvotes: 1
Views: 99
Reputation: 2478
It is not possible to pass the style as part of tables.add() method. However, if you override the style before you sync, it'll apply the style right after and the transition time shouldn't be noticeable.
try {
await Excel.run(async (context) => {
let t1 = context.workbook.worksheets.getItem('sheet1').tables.add("A1:E2", false);
t1.style = 'TableStyleMedium28';
await context.sync();
});
}
catch (error) {
OfficeHelpers.Utilities.log(error);
}
Upvotes: 1