Hi,
I am trying to format an entire row to add background colour. I am using the following code, but its not working. Could you please tell me if I am using the right code.
Dim styles1 As Styles = workbook.Styles
'Set CategoryName style
Dim styleIndex1 As Integer = styles1.Add()
Dim styleSubHead1 As Aspose.Cells.Style = styles1(styleIndex1)
styleSubHead1.BackgroundColor = Color.Red
Dim styleflag As StyleFlag = New StyleFlag
styleflag.CellShading = True
Dim row As Row = sheet1.Cells.Rows(3)
row.ApplyStyle(styleSubHead1, styleflag)
Thanks in advance!!
Hi,
Well, you may try to change/update your code segment a bit:
e,g
Sample code:
Dim styles1 As Styles = workbook.Styles
’Set CategoryName style
Dim styleIndex1 As Integer = styles1.Add()
Dim styleSubHead1 As Aspose.Cells.Style = styles1(styleIndex1)
styleSubHead1.ForegroundColor = Color.Red
styleSubHead1.Pattern = BackgroundType.Solid
Dim styleflag As StyleFlag = New StyleFlag
styleflag.CellShading = True
Dim row As Row = sheet1.Cells.Rows(3)
row.ApplyStyle(styleSubHead1, styleflag)
Thank you.
I actually got it now. I used
styleSubHead1.ForegroundColor = Color.Red
styleSubHead1.Pattern = BackgroundType.Solid
and it worked.
Hi Spoorthi,
Thanks for your posting and using Aspose.Cells.
It is good to know that your issue is now resolved. Let us know if you encounter any other issue, we will be glad to look into it and help you further.