View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
STO STO is offline
external usenet poster
 
Posts: 3
Default Excel Color Palette problem ...

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!


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

"sto" wrote in message
...
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,$C 0C0C0,$808080);

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

Any suggestion? Please!