Free Support Forum -

SetStyle vs Style.ForegroundColor

With the current cells dll ( I get a warning that Aspose.Cells.Style is obsolete. What is the new way to code the following:

wsDest.Cells(x, nDestColumn).Style.ForegroundColor = Color.Yellow
wsDest.Cells(x, nDestColumn).Style.Pattern = BackgroundType.Solid


Hi Rick,

Please try to use Cell.GetStyle and Cell.SetStyle methods which are more efficient and optimized related performance.

Dim s As Style = wsDest.Cells(x, nDestColumn).GetStyle()
s.ForegroundColor = Color.Yellow
s.Pattern = BackgroundType.Solid
wsDest.Cells(x, nDestColumn).SetStyle(s)

For further reference, kindly see the document:

Thank you.