【问题标题】:EasyXls getValue() which returns the result of the formulaEasyXls getValue() 返回公式的结果
【发布时间】:2019-08-05 11:45:10
【问题描述】:

我正在尝试导入一个 Excel 文件(使用 easyxls),其中包含带有“=3*5”等公式的单元格, 现在我想在导入期间获得 15 作为单元格的值。

有谁知道如何从 Excel 单元格中获取公式结果而不是公式本身?

到目前为止我尝试了什么 cell.getValue().. 返回公式单元格的公式,而不是结果 cell.getFormulaResultValue() ...这是我认为应该工作的,但它总是返回'#N/A'

【问题讨论】:

    标签: java excel


    【解决方案1】:

    cell.getFormulaResultValue()是你需要使用的方法,但是你需要先用worksheet.easy_computeFormulas()方法计算表。

    table.easy_getCell("A1").setValue("=3*5");
    worksheet.easy_computeFormulas(workbook, true);
    table.easy_getCell("A1").getFormulaResultValue();
    

    还可以使用 EasyXLS 检查此代码示例关于 get formula result in Excel cell

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-20
      • 1970-01-01
      • 2021-01-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多