When supplying a struct of properties as the format argument to one of the formatting methods a new cellStyle object is created each time, whether or not one has already been created in the workbook for that format. Multiple formatting operations can therefore result in a large number of duplicate cellStyles added to the workbook's style table, which has limits.
This can be avoided by first creating the cellStyle object separately (using createCellStyle() and then passing that as the format argument instead of a struct.
But it would be an improvement if formats supplied as a struct could also be re-used as far as possible without having to prepare a cellStyle object.
This could be achieved by caching the cellStyle object created from a particular format struct so that it could be re-used over mutliple calls.
A new public method to clear the cache would also be useful.
When supplying a struct of properties as the
format
argument to one of the formatting methods a new cellStyle object is created each time, whether or not one has already been created in the workbook for that format. Multiple formatting operations can therefore result in a large number of duplicate cellStyles added to the workbook's style table, which has limits.This can be avoided by first creating the cellStyle object separately (using createCellStyle() and then passing that as the
format
argument instead of a struct.But it would be an improvement if formats supplied as a struct could also be re-used as far as possible without having to prepare a cellStyle object.
This could be achieved by caching the cellStyle object created from a particular format struct so that it could be re-used over mutliple calls.
A new public method to clear the cache would also be useful.