You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2014/10/10 01:48:40 UTC
[Bug 57074] New:
HSSFCell.getCellStyle().getFillForegroundColorColor() returns incorrect color
for xls file created using Microsoft Excel 2007
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
Bug ID: 57074
Summary: HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using
Microsoft Excel 2007
Product: POI
Version: 3.9-FINAL
Hardware: PC
Status: NEW
Severity: critical
Priority: P2
Component: HSSF
Assignee: dev@poi.apache.org
Reporter: chandran.poorna@gmail.com
Created attachment 32100
--> https://issues.apache.org/bugzilla/attachment.cgi?id=32100&action=edit
MS Excel 2007 created .xls file
I have created an .xls file using Microsoft Excel 2007. The file contains a
cell with:
Background color: RGB(215, 228, 188)
Font color: RGB(0, 128, 128)
as can be seen in the Custom Colors dialog in the Excel. I tried to read the
background and foreground colors as shown below:
public class ColorTest2007 {
public static void main(String arg[]) throws Exception
{
File f = new File("david2.xls");
FileInputStream fis = new FileInputStream(f);
HSSFWorkbook workbook = new HSSFWorkbook(fis);
HSSFSheet sheet = workbook.getSheet("Sheet1");
HSSFRow row = sheet.getRow(0);
HSSFCell cell = row.getCell(0);
HSSFColor bgColor = cell.getCellStyle().getFillBackgroundColorColor();
System.out.println(bgColor.getTriplet()[0]+",
"+bgColor.getTriplet()[1]+", "+bgColor.getTriplet()[2]);
HSSFColor fontColor =
cell.getCellStyle().getFillForegroundColorColor();
System.out.println(fontColor.getTriplet()[0]+",
"+fontColor.getTriplet()[1]+", "+fontColor.getTriplet()[2]);
}
}
which resulted in:
0, 0, 0
247, 244, 239
I have also tried to use the cell.getCellStyle().getFillBackgroundColor() and
tried to retrieve the color from the custom color palette. But that also did
not return the colors seen in Excel.
I am attaching the david2.xls file. This definitely looks like a bug unless the
reading of the color from xls file created using MS Excel 2007 is unsupported.
Please let me know if there is any other way to retrieve the correct color
values.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
chandran.poorna@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #2 from chandran.poorna@gmail.com ---
I get the same result with 3.11-beta2 as well.
output for the given code:
0, 0, 0
247, 244, 239
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
Created attachment 32352
--> https://issues.apache.org/bugzilla/attachment.cgi?id=32352&action=edit
Screenshot of the Excel output when saving the fail in 1997-2003 format
FYI, when I try to save the Excel file as "1997-2003" I get the compatibility
warning as shown in the screenshot. I suppose this is related to what we see
here, seems POI does not yet read those newer colors/styles (and LibreOffice
has similar limitations).
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEEDINFO |NEW
--- Comment #7 from Dominik Stadler <do...@gmx.at> ---
There is now a reproducing unit test for this in class TestUnfixedBugs.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
Nick Burch <ap...@gagravarr.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
OS| |All
--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
3.9 is a little old, can you re-try with 3.11 beta 2?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |NEEDINFO
--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
When I open the file in LibreOffice and actually type into the cell, it is
actually using gray text on background, which is what POI is returning, e.g.
background 0, 0, 0 and foreground some high values in all three, are you sure
the file is set up with correct color for this cell?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
--- Comment #4 from chandran.poorna@gmail.com ---
Yes, I have just checked it with LibreOffice. The foreground and background
colors are different with MS Excel 2007 with the same document.
I don't see this issue with document created with MS Excel 2003. Only when I
create a .xls file with MS Excel 2007. XLS file created with MS Excel 2007 is
by default in compatibility mode and that's when the problem is.
I will attach a screenshot of the attached document opened with MS Excel 2007.
To summarize, the colors are different when the attached document is opened
with Apache OpenOffice or LibreOffice from MS Excel 2007.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
--- Comment #5 from chandran.poorna@gmail.com ---
Created attachment 32212
--> https://issues.apache.org/bugzilla/attachment.cgi?id=32212&action=edit
opened with MS Excel 2007
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|3.10-FINAL |3.11-dev
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 57074] HSSFCell.getCellStyle().getFillForegroundColorColor()
returns incorrect color for xls file created using Microsoft Excel 2007
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=57074
chandran.poorna@gmail.com changed:
What |Removed |Added
----------------------------------------------------------------------------
Version|3.9-FINAL |3.10-FINAL
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org