Page tree
Skip to end of metadata
Go to start of metadata

Whenever you change the Cell.Style property, that Cell gets its own Style object. However, if you create a new Style object and then call SetStyle or ApplyStyle on the area (Area.ApplyStyle(Style), Area.SetStyle(Style)) or range (Range.ApplyStyle(Style), Range.SetStyle(Style)) you want to affect, ExcelApplication will not have to create a separate Style object for each cell, reducing the amount of memory that is needed.

If you are applying the same style to more than one or two cells, you should say:

If you want to apply a single style to all the cells in a column, you can get the ColumnProperties object for that column and call the SetStyle method:

Using one of these two techniques to apply styles will use less memory than creating a new style for each cell or modifying the Cell.Style property directly.

For more information about using Styles in ExcelWriter, please refer to our tutorial Styles in ExcelWriter.




  • No labels