https://bz.apache.org/bugzilla/show_bug.cgi?id=65896

            Bug ID: 65896
           Summary: XSLFTable::mergeCells ineffective in single column
                    tables
           Product: POI
           Version: 5.2.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: dev@poi.apache.org
          Reporter: apa...@simondavey.me.uk
  Target Milestone: ---

Created attachment 38200
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=38200&action=edit
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);
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@poi.apache.org
For additional commands, e-mail: dev-h...@poi.apache.org

Reply via email to