【问题标题】:excel api extract row and column from resultexcel api从结果中提取行和列
【发布时间】:2021-02-04 18:18:34
【问题描述】:

我将 Microsoft JS API 与 Excel 一起使用。 当我使用以下代码时,我可以 console.log 结果:

    lastCell.load('address');

结果:Sheet1!J2804

如何从该单元格偏移以选择 A2804 ? 如何获取行的值和列的值?

【问题讨论】:

    标签: javascript excel api office-js


    【解决方案1】:

    我认为您可以从range.address 获得这些信息,例如“Sheet1!A1024”。

    如果要获取行和列的索引,可以使用range.columnIndexrange.rowIndex

      await Excel.run(async (context) => {
        const range = context.workbook.getSelectedRange();
        range.format.fill.color = "yellow";
        range.load();
    
        await context.sync();
        console.log("Row Index =" + range.rowIndex);
        console.log("Col Index =" + range.columnIndex);
    
      });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-07-11
      • 2013-10-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多