Check Custom Number Format when Setting Style.Custom Property

Possible Usage Scenarios

If you assign an invalid custom number format to the Style.Custom property, Aspose.Cells will not throw any exception. However, if you want Aspose.Cells to check whether the assigned custom number format is valid, set the Workbook.Settings.CheckCustomNumberFormat property to true.

Check Custom Number Format when setting Style.Custom property

The following sample code assigns an invalid custom number format to the Style.Custom property. Since we have already set the Workbook.Settings.CheckCustomNumberFormat property to true, it throws an exception (e.g., Invalid number format). Please read the comments in the code for more information.

Sample Code