Hi All,
I am new to POI and I am using it to read an excel sheet which has some rows/columns
marked in a particular color. I have some processing to be done based on the style
(for eg: color) of the cell. But when I do style.getFillBackgroundColor(), I always
get 64 as the value for any color. I have attached the code I am using with this mail.
String filename = "C:/WorkBook.xls";
POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(filename));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
for( int r = 0; r <= sheet.getLastRowNum(); r++ ) {
HSSFRow row = sheet.getRow(r);
System.out.println("Row : " + r);
if( row != null ) {
for( short c = 0; c <= row.getLastCellNum(); c++ ) {
HSSFCell cell = row.getCell(c);
if( cell != null ) {
HSSFCellStyle style =
cell.getCellStyle();
System.out.println(style.getFillBackgroundColor() + " " +
style.getFillPattern() + " " +
cell.getStringCellValue());
}
}
}
}
I think I am doing something wrong or have missed something. Can somebody please point
out what needs to be done to get a background color?.
Regards,
Navin
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]