You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/09/20 21:45:25 UTC
[PR] [bug-60072] HSSF: move drawing anchors when shifting rows or columns [poi]
pjfanning opened a new pull request, #1342:
URL: https://github.com/apache/poi/pull/1342
https://bz.apache.org/bugzilla/show_bug.cgi?id=60072
HSSF counterpart of #1341. `HSSFSheet.shiftRows` moved cells, merged regions, row breaks, hyperlinks and comments, but the client anchors of the other shapes in the sheet's drawing (pictures, text boxes, charts, ...) stayed put. `shiftColumns` moved nothing but cells and formulas.
This adds `HSSFRowShifter.shiftDrawingAnchors(startRow, endRow, n)` and `HSSFColumnShifter.shiftDrawingAnchors(startColumn, endColumn, n)` and calls them from `shiftRows`/`shiftColumns`, with the shared logic in `HSSFRowColShifter`.
Semantics match the XSSF change:
- A top-level shape is moved when its `HSSFClientAnchor`'s top-left row (column) is within `[start, end]`. Both corners 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.
- Results are clipped to the sheet bounds (`HSSFClientAnchor.MAX_ROW` / `MAX_COL`).
- Comments are skipped: `shiftRows` already moves them with their cells (`moveCommentsForRowShift`). Shapes inside groups use `HSSFChildAnchor`s and move with their group.
- Uses `getDrawingPatriarch()` rather than `createDrawingPatriarch()`, so a sheet with no drawing doesn't get one.
Independent of #1341 — the two PRs don't touch the same files and can go in either order.
Tests: `TestHSSFSheetShiftRows.bug60072ShiftRowsMovesDrawingAnchors` and `TestHSSFSheetShiftColumns.bug60072ShiftColumnsMovesDrawingAnchors` — a simple shape, a text box, a picture and (for rows) a comment; 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: dev-unsubscribe@poi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
Re: [PR] [bug-60072] HSSF: move drawing anchors when shifting rows or columns [poi]
Posted by "pjfanning (via GitHub)" <gi...@apache.org>.
pjfanning merged PR #1342:
URL: https://github.com/apache/poi/pull/1342
--
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: dev-unsubscribe@poi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org