https://issues.apache.org/bugzilla/show_bug.cgi?id=51037
Summary: setDefaultColumnStyle() in XSSFSheet not working
Product: POI
Version: 3.8-dev
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=26865)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26865)
Full test class
The method setDefaultColumnStyle(int column, CellStyle style) is not having any
effect in an XSSFWorkbook. This is my test code:
public static void columnStyles(boolean xml) throws IOException {
Workbook wb = xml ? new XSSFWorkbook() : new HSSFWorkbook();
CellStyle blueStyle = wb.createCellStyle();
blueStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex());
blueStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
CellStyle pinkStyle = wb.createCellStyle();
pinkStyle.setFillForegroundColor(IndexedColors.PINK.getIndex());
pinkStyle.setFillPattern(CellStyle.SOLID_FOREGROUND);
Sheet s1 = wb.createSheet("Pretty columns");
s1.setDefaultColumnStyle(4, blueStyle);
s1.setDefaultColumnStyle(6, pinkStyle);
Row r = s1.createRow(7);
r.createCell(1).setCellStyle(pinkStyle);
r.createCell(8).setCellStyle(blueStyle);
fill(s1.createRow(3), "The quick brown fox jumps over the lazy
dog".split("\\s+"));
save(wb, (xml ? "columnStyles.xlsx" : "columnStyles.xls"));
}
The styles are applied to the individual cells via setCellStyle(), but not to
the columns.
Everything works as expected when using an HSSFWorkbook.
--
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]