Hi John,
Well the color palette has 56 colors which are indexed (each color is placed on different indexes i.e., 0-55) when you need a color that is not in the palette, you have to embed it in the palette changing and replacing with the existing color using Workbook.ChangePalette() method.
I use your following code and results are perfect (see the attachment xls file)
Workbook workbook = new Workbook();
Aspose.Cells.Style style;
int styleIndex = workbook.Styles.Add();
style = workbook.Styles[styleIndex];
style.Font.Size = 10;
style.Font.IsBold = true;
style.Font.Color = Color.Black;
workbook.ChangePalette(Color.LightGray, 54);
style.ForegroundColor = Color.LightGray;
style.Pattern = BackgroundType.Solid;
style.Name = "GrayBlackLeft";
styleIndex = workbook.Styles.Add();
style = workbook.Styles[styleIndex];
style.Font.Size = 10;
style.Font.IsBold = true;
style.Font.Color = Color.Blue;
workbook.ChangePalette(Color.LightYellow, 36);
style.ForegroundColor = Color.LightYellow;
style.Pattern = BackgroundType.Solid;
style.HorizontalAlignment = TextAlignmentType.Right;
style.Name = "YellowBlueLeft";
workbook.Worksheets["Sheet1"].Cells[0,1].Style = workbook.Styles["GrayBlackLeft"];
workbook.Worksheets["Sheet1"].Cells[0,2].Style = workbook.Styles["YellowBlueLeft"];
workbook.Save("d:\\testpalette.xls");
Which version of Aspose.Cells you are using? I am using the latest 4.1.
Regards
Amjad Sahi
Aspose Nanjing Team