https://issues.apache.org/bugzilla/show_bug.cgi?id=51469

             Bug #: 51469
           Summary: XSSFRow.setRowStyle not implemented
           Product: POI
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: XSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]
    Classification: Unclassified


Created attachment 27249
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=27249
extraced xlsxs 'a' & 'b'

for HSSFRow there is setRowStyle method, XSSFRow lacks this method.

attached you'll find extracted xlsx a & b, the differing files are
xl/worksheets/sheet1.xml resp.. in both files there is a '1' in cell A1, which
has a certain format (bottom border black thin). in file 'b' the 1st row
additionally has the same format set as row format.

the differing part is:

<row r="1" spans="1:1">
vs.
<row r="1" spans="1:1" s="1" customFormat="1">

so i guess the code from XSSFCell should work for XSSFRow (+ customFormat), so
it should be something like:

    public void setCellStyle(CellStyle style) {
        if(style == null) {
            if(_row.isSetS()) { // + maybe something like: "||
_row.isSetCustomFormat()"
                _row.unsetS();
                _row.unsetCustomFormat();
            }
        } else {
            XSSFCellStyle xStyle = (XSSFCellStyle)style;
            xStyle.verifyBelongsToStylesSource(_stylesSource);

            long idx = _stylesSource.putStyle(xStyle);
            _row.setS(idx);
            _row.setCustomFormat(true);
        }
    }

the _stylesSource of XSSFRow could be handled exactly like for XSSFCell (as
it's only a pointer to row.getSheet().getWorkbook().getStylesSource()).

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to