Re: [PR] Fix getDimFromCell trailing space for XSSF in-cell picture anchors [poi]

arimu1 (via GitHub) <[email protected]>
Newsgroups gmane.comp.jakarta.poi.devel
Message-ID <PR_kwDOAAMmIM7-Vc_9-30a67454-7794-4a3e-bba5-7949aa408069@gitbox.apache.org>
arimu1 commented on PR #1211:
URL: https://github.com/apache/poi/pull/1211#issuecomment-5274402233

   Thanks for the review — you're right that the global `trailSpace = endD` change was incorrect.
   
   **What was wrong:** For XSSF, `endD` is the EMU offset from the left of the *end* cell, so trailing space must stay `dim - endD` (same fraction semantics as HSSF). Setting `trailSpace = endD` globally would:
   - add a full extra cell for multi-cell anchors with `dx2/dy2 == 0`
   - under-report normal in-cell anchors where `startD < endD` (`dim - startD - endD` instead of `endD - startD`)
   
   **Actual fix (#1201):** The bug is only the degenerate *same-cell* case (`col1==col2`, `dx1==dy1==dx2==dy2==0`) where `endD - startD == 0`, causing `picture.resize()` to fail. The updated commit reverts the global flip and handles only that case: when `startCell == endCell` and computed span `<= 0`, use full cell size if both offsets are 0, otherwise remaining cell space (`dim - leadSpace`).
   
   **Tests added:**
   1. Degenerate in-cell `(0,0,0,0)` → full cell width/height (issue repro + resize)
   2. Normal in-cell `startD < endD` → size == `endD - startD`
   3. Multi-cell `dx2==0` → width == first column only (no extra cell)
   
   Tip: `05307f004acc5427f5c1164a37b6e1c299413757`


-- 
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]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.