Free Support Forum -

Issue with changing foreground color in Excel Cells when using strange RGB configuration


I am using Aspose.Cells. v4.2 as all our software is based on this version. I am having issues with changing the foreground and background colors to any strange RGB configuration except for the basic colors such as green, yellow, red, etc. If I use a config like this:

Style stHeaderStyle = wbExcelExport.Styles[intIndex];

stHeaderStyle.Font.IsBold = true;

Color clrScenarioColorTitle = Color.FromArgb(188, 44, 37);

stHeaderStyle.ForegroundColor = clrScenarioColorTitle;

stHeaderStyle.BackgroundColor = clrScenarioColorTitle;

stHeaderStyle.Pattern = BackgroundType.Solid;

stHeaderStyle.Font.Color = Color.White;

stHeaderStyle.Font.Size = 14;

This RGB color is a reddish color, however when I use this configuration I just get a black background color.

I have to use this version as all our software is based on it and I have to keep the versions consistent. If however, this bug is fixed in a newer version, I'd push the request through to upgrade.


Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for considering Aspose.

Well, the rgb colors your are applying might not be present in the Standard Color Palette, so you have to add it first into the palette using Workbook.ChangePalette() method before setting it as a fill color of the cell: Since the MS Excel (97-2003) color palette has only 56 colors (0-55 indexed) on it, so if a color is not there, you will add the color to the palette replacing any existing color on a specified index position.

For complete ref, please check the following:

Thank you.