Free Support Forum - aspose.com

Formating a Cell's Color. Name 'Color' is not declared- error

I am trying to set a cell's background color and it is not working. I am importing an excel file then I want to see if I can change a cell's background color. I've added the 4 .css files to my project and use the 'LINK' in html to them. What am I missing?

Here is my code:

'Clears the worksheets first.

ExcelWeb1.WebWorksheets.Clear()

' Imports from a excel file.

ExcelWeb1.WebWorksheets.ImportExcelFile(fileName)

ExcelWeb1.RefreshControl()

If CheckBox1.Checked = True Then

'Dim cell1 As WebCell = ExcelWeb1.WebWorksheets(0).Cells(2, 4)

ExcelWeb1.WebWorksheets(0).Cells(2, 4).Style.BackColor = color.ForestGreen

End If

' Remember that after processing data or changing the properties of the control,

' we should call this method.

ExcelWeb1.RefreshControl()

Thanks!

I actually got it to work by using this line:

ExcelWeb1.WebWorksheets(0).Cells(3, 2).Style.BackColor = System.Drawing.Color.ForestGreen

instead of

ExcelWeb1.WebWorksheets(0).Cells(2, 4).Style.BackColor = color.ForestGreen

Hope that helps someone.