Office js 如何在Mac上使用Office.js for Excel设置表格样式?
我正试着做类似的事情Office js 如何在Mac上使用Office.js for Excel设置表格样式?,office-js,Office Js,我正试着做类似的事情 var tableOptions = {style: "TableStyleLight18"}; binding.setTableOptionsAsync(tableOptions, function(asyncResult){}); 但我一直得到以下错误 One or more of the tableOptions parameters have values that aren't allowed. Double-check the values and tr
var tableOptions = {style: "TableStyleLight18"};
binding.setTableOptionsAsync(tableOptions, function(asyncResult){});
但我一直得到以下错误
One or more of the tableOptions parameters have values that
aren't allowed. Double-check the values and try again.
如果我将setSelectedDataAsync与相同的tableOptions一起使用,我的样式将被忽略。两者在Excel Online和Windows中都可以正常工作
我错过什么了吗?如何使用Office.js在Mac for Excel中格式化表格?样式值TableStyleLight18看起来有效。
你可以试试API
表示表格样式的常量值。可能的值为:TableStyleLight1到TableStyleLight21、TableStyleMedium1到TableStyleMedium28、TableStyleDark1到TableStyleDark11。也可以指定工作簿中存在的自定义用户定义样式,但尚未指定创建自定义样式的API
try {
await Excel.run(async (context) => {
let table = context.workbook.tables.getItem('Tabl2')
table.style = 'TableStyleLight18'
await context.sync();
});
}
catch (error) {
//handle error
}