Excel.ChangePalette method


#1

I have the following code:

excel.ChangePalette(Color.FromArgb(200,224,240),53);

chart.Title.TextFont.Color = Color.FromArgb(200,224,240);

I expect this to give me a light blue colour. But instead, it gives me some shade of orange, similar to 255, 102, 0. What am I doing wrong? I am not understanding the connection between the palette index and the R/G/B values.


#2

Sorry. This problem is caused by a small bug. Please try this attached v3.7.1.1.


#3

Was my code correct ?

I think I am still getting inconsistent behaviour with the colours, but I will test it again thoroughly.

Why is it required to change the palette before assigning a colour to any of the chart elements?

Am I right in saying that ChangePalette replaces the colour in the given palette index, e.g. 53 with the colour represented by the RGB combination ? If I go to Tools/Options/Color in Excel, I see 56 colours (0-55). How are they numbered - starting with the first row and going across, or starting with the first column and going down ?


#4

Your code is correct.

Please check http://www.aspose.com/wiki/default.aspx/Aspose.Cells/ColorAndPalette.html for more information. A standard color palette is listed at http://www.aspose.com/Products/Aspose.Cells/Api/Aspose.Cells.Excel.ChangePalette.html .

If your color is already in the palette, you don't need to change the palette. You can use Excel.IsColorInPalette method to check it.