在我的android应用程序中,我有一个Excel文件,其中包含一些公式。在一个公式中,我指的是其他单元格中固定的“里程”值。
在图像的 AMOUNT 列中包含公式(= IF(F10 =“”,0,F10 * Mileage)),其中Mileage是单元格的名称 J1 ,其值为 0.485 ,如图中左上角所示。
因此,当我尝试将此excel文件复制到另一个文件时,出现此错误
W/System.err: org.apache.poi.ss.formula.FormulaParseException: Specified named range 'Mileage' does not exist in the current workbook.
答案 0 :(得分:0)
正如DavidGarcíaBodego所建议的,我们需要寻找名称管理器。 https://support.google.com/docs/answer/63175?co=GENIE.Platform%3DDesktop&hl=en&oco=0
如果您要处理Excel,则还需要复制命名的Range / cell。有关更多信息,请参见https://poi.apache.org/components/spreadsheet/quick-guide.html#NamedRanges
这就是我能够复制工作表中所有命名的范围/单元格的方式
for (int i = 0; i < workbookSource.getNumberOfNames(); i++) {
Name namedCel4 = workbookDestination.createName();
namedCel4.setNameName(workbookSource.getNameAt(i).getNameName());
namedCel4.setRefersToFormula(workbookSource.getNameAt(i).getRefersToFormula());
}