Bug 65896 - XSLFTable::mergeCells ineffective in single column tables
Summary: XSLFTable::mergeCells ineffective in single column tables
Status: NEW
Alias: None
Product: POI
Classification: Unclassified
Component: XSLF (show other bugs)
Version: 5.2.0-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-17 12:44 UTC by Simon Davey
Modified: 2022-03-19 08:45 UTC (History)
0 users



Attachments
Testcase and Workaround demo - source (3.43 KB, text/plain)
2022-02-17 12:44 UTC, Simon Davey
Details
Testcase and Workaround demo - output (25.15 KB, application/zip)
2022-02-17 12:44 UTC, Simon Davey
Details
Testcase and Workaround demo - output (screenshot) (16.96 KB, image/png)
2022-02-17 12:45 UTC, Simon Davey
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Davey 2022-02-17 12:44:01 UTC
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);
    }
Comment 1 Simon Davey 2022-02-17 12:44:33 UTC
Created attachment 38201 [details]
Testcase and Workaround demo - output
Comment 2 Simon Davey 2022-02-17 12:45:04 UTC
Created attachment 38202 [details]
Testcase and Workaround demo - output (screenshot)