Color problem

I’m setting the background color of a cell using the following code:

XL.ChangePalette(Color.Orange, 46)
style.ForegroundColor = Color.Orange
oCell.style = style

Although the color is being set, it is NOT being set to Orange, but a lighter shade of orange instead. The color I get is (R255, G165, B0) - this is NOT Orange.

Orange is shown in the standard Excel palette (R255, G102, B0), and when I use the following statement I get TRUE:

Dim c As Boolean = XL.IsColorInPalette(Color.Orange)

I really need to get the correct color Orange as this is a client’s corporate color.

Any suggestions…?

I used the following code:
Console.WriteLine(Color.Orange.R);
Console.WriteLine(Color.Orange.G);
Console.WriteLine(Color.Orange.B);

It shows 255, 165, 0.

If you want to set a color in standard palette, you don’t need to change the palette:

style.ForegroundColor = Color.FromArgb(255, 102, 0)
oCell.style = style



Great - that sorted it!

Thanks again for the quick response… Cool