https://issues.apache.org/bugzilla/show_bug.cgi?id=55844

            Bug ID: 55844
           Summary: Inline custom colors not correctly extracted by
                    HSSFCellStyle#getFillForegroundColorColor
           Product: POI
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
          Assignee: [email protected]
          Reporter: [email protected]

Created attachment 31091
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31091&action=edit
sample xls with inline custom colors created in Excel 2013

The attached color.xls is created with excel 2013. cell 0,0 has a custom
foreground fill color applied with rgb values 0, 100, 255.

Extracting that color with the below sample code gives 0:0:FFFF, (which is not
the color in the actual workbook).

Note that when this same book is saved as xlsx, using the XSSF code allows you
to extract the correct RGB value.

import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.*;
import java.io.FileInputStream;

public class TestColor {
  public static void main(String[] args) throws Exception {
    FileInputStream in = new FileInputStream(args[0]);
    Workbook wb = WorkbookFactory.create(in);
    Sheet sheet = wb.getSheetAt(0);
    Cell cell = sheet.getRow(0).getCell(0);
   
System.out.println(((HSSFColor)cell.getCellStyle().getFillForegroundColorColor()).getHexString());
  }
}

-- 
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]

Reply via email to