https://issues.apache.org/bugzilla/show_bug.cgi?id=50912
Summary: Applying an HSSFCellStyle on an HSSFCell has no effect
Product: POI
Version: 3.8-dev
Platform: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=26761)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=26761)
Template Excel file with user-defined cellstyle "FatFont"
Please see the following snippet of code which detects a user-defined cellstyle
in an Excel file and then tries to apply this celstyle on the top left cell in
the 'MySheet' worksheet.
HSSFWorkbook wb = new HSSFWorkbook(new FileInputStream("template.xls"));
for(short i = 0; i < wb.getNumCellStyles(); i++) {
HSSFCellStyle cs = wb.getCellStyleAt(i);
String userStyleName = cs.getUserStyleName();
if(userStyleName != null && userStyleName.equals("FatFont")) {
System.out.println("Found!");
wb.getSheet("MySheet").getRow(0).getCell(0).setCellStyle(cs);
break;
}
}
FileOutputStream fos = new FileOutputStream("template2.xls");
wb.write(fos);
fos.close();
When opening template2.xls it can be seen that applying the detected cellstyle
actually had no effect.
Please find the file template.xls attached.
--
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]