Free Support Forum - aspose.com

GetStyle().BackgroundColor

Cell.GetStyle().BackgroundColor returns either 0xFFFFFF or 0x000000 instead of the actual background colors.


Hi,

Please use Style.ForegroundColor property instead.

Please see the code below, its output, source xlsx file and the screenshot for more help.

C#


string path = @“C:\Documents and Settings\Home\Desktop\source.xlsx”;


Workbook workbook = new Workbook(path);


Cell cellA1 = workbook.Worksheets[0].Cells[“A1”];


string value = cellA1.StringValue;


Style cellStyle = cellA1.GetStyle();


Color cellColor = cellStyle.ForegroundColor;


Debug.WriteLine(cellColor);

Output:
Color [A=0, R=255, G=0, B=0]

Screenshot: