Colors available in the current palette

Hi

In reference to the color table from http://www.aspose.com/Products/Aspose.Cells/Api/index.html?url=http://www.aspose.com/Products/Aspose.Cells/Api/Aspose.Cells.Workbook.ChangePalette.html
I am trying to loop through the colors available in the current palette to display them in cells with this code and it is not working:

Public Shared Sub TestColors(ByVal mWorkBook As Aspose.Cells.Workbook, ByVal pSheet As Worksheet, ByRef pRow As Integer)

For intI As Integer = 0 To 55

With pSheet.Cells(pRow, 0)

.PutValue("Test")

.Style.ForegroundColor = mWorkBook.Colors(intI)

End With

pRow += 1

Next

End Sub

Can I display a sample of all the colors of the current palette?

Hi,

Please add a line to your code to make it work i.e.,

Public Shared Sub TestColors(ByVal mWorkBook As Aspose.Cells.Workbook, ByVal pSheet As Worksheet, ByRef pRow As Integer)

For intI As Integer = 0 To 55

With pSheet.Cells(pRow, 0)

.PutValue("Test")

.Style.ForegroundColor = mWorkBook.Colors(intI)

.Style.Pattern = BackgroundType.Solid;

End With

pRow += 1

Next

End Sub

For further reference, please check the following thread:

Thank you.

Oups. That's really great thanks.

Just to finish on that, do you know a method to get the color name (ie: Alice Blue) from the color?

Hi,

Well, AliceBlue color is not present on the standard color palette, so you have to add it on the palette changing the palette.

e.g..,

workbook.ChangePalette(System.Drawing.Color.AliceBlue,55)

Thank you.