Version

CreateNewWorksheetCellFormat Method

Creates new worksheet cell format.
Syntax
'Declaration
 
Public Function CreateNewWorksheetCellFormat() As IWorksheetCellFormat
public IWorksheetCellFormat CreateNewWorksheetCellFormat()

Return Value

The cell format which was created.
Remarks

IWorksheetCellFormat describes cell specific formatting (font, number format, appearance etc.). Total number of different cell formats in excel workbook is limited to MaxExcelCellFormatCount. If many parts of excel workbook have same and complex (more than one property in common) cell formatting, use this method in following manner:

  1. Create new cell format with CreateNewWorksheetCellFormat,
  2. Set all necessary properties on given cell format,
  3. Apply cell format to all excel objects which use it with IWorksheetCellFormat.SetFormatting method.

Use of this procedure will simplify you code for complex cell formats and increase speed of resulting program. It will not reduce total number of cell formats in a workbook as cell formats are internally cached no matter which method is used.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also