Hi, I have no idea why I could not apply background color on the cell. Please check my code
Dim cellstyle_red As Aspose.Cells.Style = A1cell.GetStyle
cellstyle_red.VerticalAlignment = TextAlignmentType.Top
cellstyle_red.HorizontalAlignment = TextAlignmentType.Center
cellstyle_red.Borders(BorderType.BottomBorder).LineStyle = CellBorderType.Thin
cellstyle_red.Borders(BorderType.LeftBorder).LineStyle = CellBorderType.Thin
cellstyle_red.Borders(BorderType.RightBorder).LineStyle = CellBorderType.Thin
cellstyle_red.Borders(BorderType.TopBorder).LineStyle = CellBorderType.Thin
cellstyle_red.BackgroundColor = System.Drawing.Color.Red
cellstyle_red.Pattern = BackgroundType.Solid
cellstyle_red.Number = 1
If (student_list(y, no_of_report + 7 - 4)) <> “” Then
difference = Val(student_list(y, no_of_report + 7 - 2)) - Val(student_list(y, no_of_report + 7 - 4))
Else
difference = 0
End If
sheet.Cells(row, col).PutValue(difference.ToString, True, True) '1
'Debug.Print(Val(TB_Diff.Text))
If difference <= Val(TB_Diff.Text) Then
sheet.Cells(row, col).SetStyle(cellstyle_red)
'sheet.GetRow(row).GetCell(col).CellStyle = headerCellStyle8
Else
sheet.Cells(row, col).SetStyle(cellstyle_center)
'sheet.GetRow(row).GetCell(col).CellStyle = headerCellStyle6
End If
Please help