Hi, I’m having troubles setting forground and backgroud
colors, here is a sample code I’m
using…
Aspose.Cells.Style cellStyle =
(workbook.Worksheets[0].Cells[rowIndex,
colIndex]).GetDisplayStyle();
cellStyle.BackgroundColor =
grid.Cols[colIndex].StyleDisplay.BackColor;
cellStyle.ForegroundColor =
grid.Cols[colIndex].StyleDisplay.ForeColor;
cellStyle.Pattern = BackgroundType.Solid;
(workbook.Worksheets[0].Cells[rowIndex,
colIndex]).SetStyle(cellStyle);
workbook.Worksheets[0].Cells[rowIndex, colIndex].PutValue(value);
All spreadsheet is turning
black…
Could you please let me know how I can apply
both forground and background colors to the
cells.
Regards,
Hi,
I think the color you are setting for foreground/background might not be present in the Excel Standard color palette. For you info, MS Excel(97-2003) Standard color palette only has 56 colors, so, if a color is not there, you have to add it to the color palette before setting the color for the cells, please check the doc topic for your reference: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/colors-and-palette.html
Also, if you want to set both foreground and background colors, you have to select some pattern other than BackgroundType.Solid/ BackgroundType.None, least the background color won't be effective. Please check the doc topic for your complete reference: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/colors-background-patterns.html
Feel free to contact us any time if you need further clarification or help.
Thank you and have a good day!