Aspose.Cells change style of cell

It was possible in previous versions of Aspose Cells to apply changes directly to cell.
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!

HOWTO: Repair Logitech M325 Mouse

FixIt says that you will find single screw under CE label. It isn't always true.