Starting from version 7.0 you have to call first GetStyle() method and then call SetStyle(s) method.
You can use simple extension method to mimic old behavior.
public static class AsposeCellsExt
{
public static void ChangeStyle(this Cell cell, Action<Style> applyChangesTo)
{
Style s = cell.GetStyle();
applyChangesTo(s);
cell.SetStyle(s);
}
}
and now to fill A1 cell with green background you can execute just single line
cells[0, 0].ChangeStyle(s => { s.ForegroundColor = GREEN; s.Pattern = Aspose.Cells.BackgroundType.Solid; });
Enjoy!
No comments:
Post a Comment