Bug 50787 - XSSFColor.getRgbWithTint() returns incorrect color for theme colors from 3-4 columns (brown and blue tints)
Summary: XSSFColor.getRgbWithTint() returns incorrect color for theme colors from 3-4 ...
Status: NEEDINFO
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks: 54689
  Show dependency tree
 
Reported: 2011-02-15 11:37 UTC by andrei
Modified: 2016-06-17 08:11 UTC (History)
0 users



Attachments
Excel-POI theme colors converting (62.57 KB, image/png)
2011-02-22 13:01 UTC, andrei
Details

Note You need to log in before you can comment on or make changes to this bug.
Description andrei 2011-02-15 11:37:04 UTC
Steps:
1. Create xlsx doc.
2. Set fill color for cell with theme colors from 3 or 4 columns (brown or blue tints).
3. Call cell.getFillForegroundXSSFColor().getRgbWithTint().

Actual: incorrect color (color is similar but not exactly the same)
Expected: correct color
Comment 1 Nick Burch 2011-02-15 11:53:05 UTC
Is it a problem with what goes into the file, or with how we return it?

Since a .xlsx file is a zip of xml files, any chance you could take a look inside and see what value actually got stored by excel? Are we returning that, or are we getting that wrong?
Comment 2 andrei 2011-02-16 05:43:30 UTC
Problem in applying tint to rgb. Algorithm you use applies tint to the brown and blue colors incorrectly.
Comment 3 Nick Burch 2011-02-16 06:40:15 UTC
The support for tint came from a user contributed patch from bug #48432

Are you able to identify the logic we should correct it to?
Comment 4 andrei 2011-02-16 08:00:08 UTC
Unfortunately I am not able yet to fix it
Comment 5 Nick Burch 2011-02-18 10:50:57 UTC
Are you able to figure out what the values should be easily?

If so, could you pick say half a dozen colours, and then apply three different tint to each? From that, work out what the values should be, as compared to what they are, and we might have a good shot at spotting what's wrong with the current logic.
Comment 6 Nick Burch 2011-02-18 10:54:10 UTC
(There is some information from Microsoft on how to do the tinting and shading at http://social.msdn.microsoft.com/Forums/en/oxmlsdk/thread/f6d26f2c-114f-4a0d-8bca-a27442aec4d0 but we'll want a few sets of numbers for a unit test no matter what!)
Comment 7 andrei 2011-02-22 13:01:42 UTC
Created attachment 26689 [details]
Excel-POI theme colors converting

Please see attachment
Comment 8 Nick Burch 2011-03-04 12:16:40 UTC
Do you know what the text in the excel cells is supposed to be showing?

When I use an image editor to check the colours in the png, then I find that the POI colours match the hex strings in them. However, the excel cell colours are not the same as the hex string. 

For example, D6 says 8A8149, but my image editor says that the colour is 948b54. Equally, K7 says E16207 but my image editor claims it's e46d0a

FWIW, H7 reads 6A8832 but my image editor says it's 75923c. It's POI equivalent says 748C42, and my image editor says 748c42 so agrees again, so it's not just the "incorrect" ones where something odd is going on.
Comment 9 Javen O'Neal 2016-06-17 08:11:57 UTC
This may have been fixed in r1126696.

Can you verify if this bug exists in the latest version of POI?

Related: bug 51236 and bug 53274