Cells(1- 1).Style.BackgroundColor.ToString



when I use this

Cells(r, 2).Style.BackgroundColor.ToString to obtain the backgroundColor of the cell, it always return Black color, even though it was yallow.



Please try Style.ForegroundColor.


We get the same result. Although I cannot see how using the foreground property to get the background color could help. Is te Forground property used to set the Font Color, or the cell background?


Note: When the color is set from within Aspose, it works. but if we are using a template that was created in Excel, and we try to access those properties, we always get the color black.


Please try the following code:

Excel excel = new Excel();

The output is:
Color [A=255, R=255, G=255, B=0]

You can use Font.Color to set font color. When the cell background pattern is solid, only foreground color will take effect. If you change the background pattern to other values, foreground color and background color will all take effect.