pjfanning opened a new pull request, #1341: URL: https://github.com/apache/poi/pull/1341
https://bz.apache.org/bugzilla/show_bug.cgi?id=60072 `XSSFSheet.shiftRows`/`shiftColumns` moved cells, merged regions, formulas, conditional formatting, hyperlinks and comments, but the anchors of the shapes in the sheet's drawing stayed put, so charts and pictures ended up over the wrong rows after inserting or moving rows. This adds `XSSFRowShifter.shiftDrawingAnchors(startRow, endRow, n)` and `XSSFColumnShifter.shiftDrawingAnchors(startColumn, endColumn, n)` and calls them from `shiftRows`/`shiftColumns`, with the shared logic in `XSSFRowColShifter` next to the other row/column-common helpers. Semantics: - A shape is moved when its top-left anchor row (column) is within `[start, end]`. Both `from` and `to` are shifted so the shape keeps its size — Excel's "move but don't size with cells". Shapes whose top-left is outside the range are untouched (no growing/shrinking of shapes that straddle the range). - `oneCellAnchor`s are moved the same way; `absoluteAnchor`s are positioned in EMUs and are left alone. - Results are clipped to the sheet bounds. - Operates on the `CTDrawing` markers, so `XSSFClientAnchor`s already held by callers (via `XSSFShape.getAnchor()`) see the change. This is the 2016 patch from the bug report, extended to respect `endRow` (the original treated every shift as an insert at `startRow`), to handle `oneCellAnchor`s and columns, and to clip. Not covered: bug 59306 (chart data-series references are not shifted) — that's a separate formula-shifting job on the chart XML. Tests: `TestXSSFSheetShiftRows.bug60072ShiftRowsMovesDrawingAnchors` and `TestXSSFSheetShiftColumns.bug60072ShiftColumnsMovesDrawingAnchors` — a simple shape, a chart, a picture, a one-cell anchor and an absolute anchor; shift down (insert), shift a sub-range up, write out and read back. 🤖 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]
