我专门尝试在数组上调用此功能:
https://learn.microsoft.com/en-us/javascript/api/excel/excel/excel.range?view=fiew=office-js#getCellProperties-cellproperties-cellproperties loadoptions-
从文档中尚不清楚完成这项工作所需的内容。我肯定在这里错过了一些东西。以下是我代码的当前状态。
我还检查了我正在使用API v1.9的Excel中运行的加载项。
我尝试设置与CellPropertiesloadoptions所描述的界面相匹配的各种对象 - 但再次不确定该文档的需求实际上是什么。
async function getFormatsForCellRange () {
return await Excel.run(async context => {
const table = await context.workbook.tables.getItem(observationConst.TABLE_NAME)
const range = table.getRange()
const cellProperties = range.getCellProperties()
console.log(cellProperties)
})
}
文档指出,调用getCellProperties的结果应为2D数组。
var actualData = rangeSrc.getCellProperties({
format: {
font: {
bold: true,
color: true,
fill: true
italic: true,
name: true,
underline: true,
size: true,
strikethrough: true,
subscript: true,
superscript: true,
tintAndShade: true
}
}