Bug 49262

Summary: HSSFPalette not contain exist cell foregroundcolor
Product: POI Reporter: longxibo
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P2    
Version: 3.6-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: for fixbug
a xls cell foreground intercept picture

Description longxibo 2010-05-07 03:25:36 UTC
I use office2007 created a xls,in Cell X1,fill foregroundcolor is RGB(79,129,189).
But when I use HSSFWorkbook open this xls and getCustomPalette,In return HSSFPalette object can't found Color RGB(79,129,189).
java code as follows:
HSSFWorkbook wb;
	FileInputStream finput=null;
	File file;
	
	file = new File("D:\\mysoft\\rpsp-sample\\testfile\\testcopycell.xls");
	try {
	    finput = new FileInputStream(file);
	    wb = new HSSFWorkbook(finput);
	    HSSFPalette palette = wb.getCustomPalette();
	    System.out.print(palette);
	} catch (FileNotFoundException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	} catch (IOException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	}finally{
	    try {
		finput.close();
	    } catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	    }
	}
Comment 1 longxibo 2010-05-07 03:37:50 UTC
Created attachment 25412 [details]
for fixbug

d
Comment 2 Nick Burch 2010-05-28 11:27:48 UTC
Your file really doesn't seem to have a cell with that color.

Opening open the file, I see the dark blue is 51,51,153 (X1) and the light blue is 153,229,229 (Y1). So, poi won't find the color you mentioned, because it isn't there...
Comment 3 longxibo 2010-06-07 22:12:34 UTC
(In reply to comment #2)
> Your file really doesn't seem to have a cell with that color.
> Opening open the file, I see the dark blue is 51,51,153 (X1) and the light blue
> is 153,229,229 (Y1). So, poi won't find the color you mentioned, because it
> isn't there...

You certitude open that xls with office2007? I upload the intercept picture
Comment 4 longxibo 2010-06-07 22:55:57 UTC
Created attachment 25543 [details]
a xls cell foreground intercept picture
Comment 5 Nick Burch 2010-06-10 07:35:43 UTC
In your screenshot, I can see your excel claiming the colour is 79/129/189. Loading the screenshot into an image program I can confirm that the colour shown really is 79/129/189

However, when I load the excel file up, the blue I see isn't the same blue that was in your screenshot. I see a darker blue of 51,51,153. Looking in the excel file at the palette records, the colour really is defined as 51,51,153. The colour 79,129,189 isn't in the palette.

So, I think there must be something very odd going on with your copy of excel. It is showing you one colour, but recording a quite different one. Not sure what we can do to help here - if the colour doesn't get put in the file, we can't read it back out again...