I'm trying to use copyRowFrom(...);
to copy the first row of a spreadsheet to the first row of a new XSSFSheet but something is not working right.
You can find the XSSFRow class and the method here:
https://github.com/apache/poi/blob/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java#L581
I'm getting IllegalArgumentException("amountToMove must not be zero")
from FormulaShifter.java:
https://github.com/apache/poi/blob/trunk/src/java/org/apache/poi/ss/formula/FormulaShifter.java#L80
It seems that the problem is at line 623 of XSSFRow where FormulaShifter.createForRowCopy(...)
is invoked with parameter rowDifference = 0
because source row is 0 and destination row is 0:
https://github.com/apache/poi/blob/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFRow.java#L623
I don't know, maybe it's an error, but when reaching line 80 in FormulaShifter.java the parameter rowDifference corresponds to amountToMove which is 0 so it throws IllegalArgumentException.
Am I missing something or is this a bug of copyRowFrom(...);
method in XSSFRow?