pjfanning opened a new pull request, #1417: URL: https://github.com/apache/poi/pull/1417
Fixes #1414. `HSSFRow.copyRowFrom` built its `FormulaShifter` with `SpreadsheetVersion.EXCEL2007`. This now uses `EXCEL97`, as `HSSFSheet.shiftRows` does. The effect was worse than the issue describes. A relative reference shifted past row 65,536 became something like `B65537`. The `.xls` formula parser reads that as an undefined name, so `copyRowFrom` threw `FormulaParseException` rather than leaving an invalid reference. With `EXCEL97`, such references become `#REF!`. The new test reproduces the exception without the fix. **Not changed: the sheet index (the issue's second point).** In `RowCopy` mode, `FormulaShifter` never looks at the sheet index: `adjustPtgDueToCopy` shifts every relative reference, whichever sheet it points to, as an Excel copy does. So swapping in `checkExternSheet(sheetIndex)` would not change any result. It would also add a side effect: `checkExternSheet` creates link-table/EXTERNSHEET records when they are missing. The index would also have to change in `HSSFRowColShifter.shiftFormula` to stay consistent. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
