Created attachment 22323 [details] Test workbook Version: 3.1-FINAL-20080629 (not in the version listbox) After upgrading POI library to version 3.1 FINAL in my project I have found that there is a bug in retrieving fill background color. It returns value 64 for any cell in the worksheet. I attach sample Excel file (created in Excel 2000 if it does matter), on which the following code fails. <pre> HSSFSheet sheet = workBook.getSheet( "Sheet1" ); HSSFRow row = sheet.getRow( sheet.getFirstRowNum() ); StringBuilder sb = new StringBuilder( "Background color test:\n"); boolean flag = false; for( short colIx = row.getFirstCellNum(); colIx < row.getLastCellNum(); colIx++ ) { HSSFCell cell = row.getCell( colIx ); if( cell == null ) { continue; } short bgColor = cell.getCellStyle().getFillBackgroundColor(); if( bgColor != 64 ) { flag = true; } sb.append( "Column " ).append( colIx ).append( " has background color index " ) .append( bgColor ).append( "\n" ); } System.out.println( sb.toString() ); assertTrue( flag ); </pre>
This is as expected. You've setup your cells with a foreground colour fill, and not a background one. If you check the foreground fill colour, it'll have the values you want.