Colour difference between Delphi and Excel

Hi

I'm using the latest version of advanced grid and on the screen it is displaying perfectly.  When I export to Excel however, the heading rows come out a totally different colour in Excel compared to what is displayed in my program.  Excel is set to mimic the program and the colours are being sent in hex format.

I've attached a screenshot so you can see, with the delphi exe on the top and excel on the bottom.


Many thanks in advance for any help.

  1. Gradients in TAdvStringGrid are exported as solid colors.
    2) Excel has a limited size in color table , so we need to map 24bit colors to a palette of 127 colors and that can cause such differences

To add to what Bruno said, if you are using TAdvGridExcelIO to do the export, you might try setting:

AdvGridExcelIO.UseExcelStandardColorPalette := false;

before exporting. By default, AdvGridExcelIO will try to use the 56 indexed colors Excel already  has, and map to the nearest of them. But, if you set UseExcelStandardColorPalette = false, it will modify the 56-color palette to match your colors. Of course, people editing the file will now see you modified palette, but the result should look much more like the original grid.

As a last comment, if you have a FlexCel license, you can also use TAdvGridFilters:
http://www.tmssoftware.com/site/advgridfilters.asp

The filters support Excel 2007 colors which are 24 bit instead of indexed (I've written about it here: http://www.tmssoftware.com/site/blog.asp?post=135 ). So when saving to xlsx, it will write the real colors. And when exporting to xls, it will save both the real 24bit color and the nearest indeed color.If you open the generated file in Excel 2007, it will use the 24bit color from the xls file, while if you open it in 2003 it will still show the indexed color.

So using the filters won't really help for Excel 2003, but if your users are in 2007 or newer, they will see the real colors.

Regards,
   Adrian.

Hi Adrian and Bruno

Thanks very much for the information. We set the UseExcelStandardColorPalette = false and everything is working as it should.