Grid colors display as black when loaded into Excel

Article ID: 733
Last updated: 11 Jun, 2018
Article ID: 733
Last updated: 11 Jun, 2018
Revision: 3
Views: 1704
Posted: 27 Sep, 2001
by Meltreger B.
Updated: 11 Jun, 2018
by Meltreger B.

Problem


Certain background and text colors display as black when loaded into Excel from an XLS file saved with Objective Grid Pro. 


Cause


An Excel spreadsheet maintains a color palette of 56 colors. If a cell requests a color not in this palette, Excel displays that color as black. It does not attempt to 'get a nearest color'.


Action


To avoid these 'black cells' in Excel, you should make sure the Excel color palette saved by Objective Grid Pro contains all the colors you are using in your grid. Objective Grid Pro defaults to a 'standard palette' of colors, which may or may not include all the colors in your grid. Objective Grid Pro does not try to automatically add colors to its Excel palette as it may overwrite some color you want available to your users. So, you have to explicitly set any specific colors you want available into this palette if they are not part of the default palette. To see the default palette colors, look at the COLORREF g_ref definition in the file Objective StudioSrcGridExcelgxextbl.cpp.

// Adding a custom color to OG's Excel color palette
// avoids the black color in Excel

CGXExcelColorTable* pColorTable = (CGXExcelColorTable*)
    GXExGetTableMap()->LocateHandler(typePalette);

UINT nColorIndex = 32;

// Save custom color to spot 32 in palette
pColorTable->SetColorWriteIndex(RGB(255,255,159), nColorIndex);


 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 733
Last updated: 11 Jun, 2018
Revision: 3
Views: 1704
Posted: 27 Sep, 2001 by Meltreger B.
Updated: 11 Jun, 2018 by Meltreger B.

Others in this category