office-js - JavaScript excel API 中的范围函数 getCellProperties 是如何工作的?
问题描述
我特别想在一个数组上调用这个函数:
从文档中确实不清楚要完成这项工作需要什么。我肯定在这里遗漏了一些东西。以下是我的代码的当前状态。
我还检查了我正在构建的加载项是否在使用 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 的结果应该是一个二维数组。
解决方案
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
}
}
推荐阅读
- php - 为什么我发送的邮件会在这个表单中命名?
- php - 安装失败,正在将 ./composer.json 和 ./composer.lock 还原为其原始内容
- windows - 如何将凭据添加到注册表并在 Powershell 脚本中使用它们
- npm - 无法发布 npm 包(E403:禁止)
- video-streaming - webrtc重新协商的向下兼容性
- python-3.x - 没有参数的 Depends 有什么作用?
- c# - docfx 元数据步骤失败并出现错误“无法加载 SDK 解析器”
- jupyter-notebook - 为什么会出现错误,例如 SageMath 中没有名为 sagenb 的模块?
- mysql - 我的 liquibase 更新日志有什么问题?
- python - 遍历包含 2 个值的列表,将它们保存到变量中