我有一个简单的Excel工作表,其中包含基本excel公式,例如sums,以及从另一个单元格中检索值。现在,我想在两个现有行之间插入一个空行(我已经看了How to insert a row between two rows in an existing excel with HSSF (Apache POI),但我遇到了一些奇怪的错误)。
所以我尝试通过这样做来改变行:
worksheet.shiftRows(15,16,2);
我得到了这个回报:
Exception in thread "main" java.lang.RuntimeException: not implemented yet
at org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getExternalSheetIndex(XSSFEvaluationWorkbook.java:127)
at org.apache.poi.ss.formula.FormulaParser.createAreaRefParseNode(FormulaParser.java:615)
at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:462)
at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:268)
at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1119)
at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1079)
at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1066)
at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1426)
at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1526)
at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1510)
at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1467)
at org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1447)
at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1568)
at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:176)
at org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateNamedRanges(XSSFRowShifter.java:116)
at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2363)
at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2306)
at com.shel.myProgram.workbook.copyAndInsert(workbook.java:120)
at com.shel.myProgram.workbook.test(workbook.java:111)
at com.shel.myProgram.driver.main(driver.java:24)
编辑:
我正在使用这种依赖:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
答案 0 :(得分:0)
试试这个。 sheet.shiftRows(currentRow, sheet.getLastRowNum()+1, amount, true,true);