DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=44461>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=44461

           Summary: shiftRows don't copy the CellStyle
           Product: POI
           Version: 3.0
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P3
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]


If I use HSSFSheet#shiftRows() it will not copy the CellStyle of the row befor. 

I fix it very bad and slowly this way:
public void insertRowAfter(int rowNum) {
                HSSFRow row = sheet.getRow(rowNum);
                sheet.shiftRows(rowNum + 1, sheet.getLastRowNum(), 1, true, 
true);
                
                HSSFRow newRow = sheet.getRow(rowNum + 1);
                for (short i = 0; i <= row.getLastCellNum(); i++) {
                        HSSFCell cell = row.getCell(i);
                        HSSFCell newCell = newRow.getCell(i);
                        if (cell != null) {
                                if (newCell == null)
                                        newCell = newRow.createCell(i);
                                newCell.setCellStyle(cell.getCellStyle());
                        }
                }
        }

Is this a bug- or future- request?

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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to