Summary: | XSLFTable::mergeCells ineffective in single column tables | ||
---|---|---|---|
Product: | POI | Reporter: | Simon Davey <apache> |
Component: | XSLF | Assignee: | POI Developers List <dev> |
Status: | NEW --- | ||
Severity: | normal | ||
Priority: | P2 | ||
Version: | 5.2.0-FINAL | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
Testcase and Workaround demo - source
Testcase and Workaround demo - output Testcase and Workaround demo - output (screenshot) |
Created attachment 38201 [details]
Testcase and Workaround demo - output
Created attachment 38202 [details]
Testcase and Workaround demo - output (screenshot)
|
Created attachment 38200 [details] Testcase and Workaround demo - source We have found an issue where the POI XSLFTable::mergeCells method seems ineffective at setting rowspans if the table only has a single column. We have seen that POI is setting the rowspan=... attribute in the output Slide XML, however MS PowerPoint is ignoring it. Trying the same cell merging manually in PowerPoint GUI reveals that instead of setting rowspan, PowerPoint will remove the spanned-over rows and set the height of the first row to the total of the spanned over rows. This makes me wonder if the POI XSLFTable::mergeCells method needs an update to mimick this technique along the lines of: if (tbl.getNumberOfColumns() == 1) { double h = tbl.getRowHeight(fromRow); // accumulate spanned-over row heights as we remove them for (int r = toRow; r > fromRow; --r) { h += tbl.getRowHeight(r); tbl.removeRow(r); } tbl.setRowHeight(fromRow, h); } else { tbl.mergeCells(fromRow, toRow, fromCol, toCol); }