Excel Color Palette problem ...

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi to all,

I have a very strange problems with colors.

I have a program that does some database reports and brings those report to
the user. Then the user can print and export to excel /using 3rd party
components/. Everything is going ok, except when using custom colors for the
grid background.
Then some odd colors are used when the report is opened with Excel, not the
colors I defined.

I searched the newsgroups and found out that there is a DefaultColorPalete
thing.
Then I found:
http://www.mvps.org/dmcritchie/excel/colors.htm

I tested with this color list, it seems only the first 8 colors are ok,
while the next 8 are not.
Here is the list I used (from the link above):
$000000,$FFFFFF ,$FF0000 ,$00FF00,$0000FF, $FFFF00, $FF00FF,$00FFFF,
$800000,$008000,$000080,$808000,$800080,$008080,$C0C0C0,$808080);

I used Excel97 and 2003 for testing - same strange results for both.

Any suggestion? Please!
 
How did you define and/or apply your custom colours.

All the colours in your list are colours that exist in the default Excel
palette, assigned to the following colorindex's (in same order as your list)

1 18/54 3 4 5 6 7 8
9 10 11 12 13 14 15 16

(18 & 54 colorindex's have same colours in a default palette)

the equivalent "long" colour values are
0, 6697881, 255, 65280, 16711680, 65535, 16711935, 16776960
128, 32768, 8388608, 32896, 8388736, 8421376, 12632256, 8421504

If you have either applied these colorindex's or colour's as formats your
colours should print correctly (subject your printer)

However if you have applied some other RGB colours that do not exist in the
default palette, then colours will map to what Excel calculates is the
closest match to one of the default colours, then apply the colorindex
holding that colour.

You can customize some palette colours as required, then apply either the
relevant colorindex or the RGB value.

Regards,
Peter T
 
10x Peter for quick responce.

I am using a 3rd party components, which seems to not treat the color
problem quite well. They do not use COM or OLE for creating the Excel file,
insted they created the file on the fly in binary format (i think it's called
biff8).

The problem was that almost non of the color matched. I searched the forum
about similar problems and replaced thier color palette with the one from the
link above.
It seems to handle the first 8 colors, not the rest. But there might be an
issue with their code, I will have to recheck it again.

But since you confirm the color palette is OK, I will put more efforts on
debuggin the code.

10x again!
 
Something went totally wrong with my transcription of the second colour in
your list -

colorindex 18/54 colour-value 6697881
is in fact
colorindex 2, colour-value 16777215 (#FFFFFF - white)

Your colours are comprise the original "16" video colours

Curiosity - how do your 3rd party components colour format Excel cells
without using COM or OLE.

Regards,
Peter T
 
Didn't he say they wrote a Biff8 file - just like Excel/any workbook file,
it would include information on the formatting of the cells.
 
Ah, of course. Thanks.

Regards,
Peter T

Tom Ogilvy said:
Didn't he say they wrote a Biff8 file - just like Excel/any workbook file,
it would include information on the formatting of the cells.

--
Regards,
Tom Ogilvy

be
 
I wanted to thank you for that link to the excel colors. It was exactly what
I was looking for - just the basics are good enough for me.

Ruth
 
Back
Top