Check Custom Number Format when Setting Style.Custom Property

Possible Usage Scenarios

If you assign an invalid custom number format to Style.setCustom(string) method, then Aspose.Cells for Node.js via C++ will not throw an exception. However, if you want Aspose.Cells to check whether the assigned custom number format is valid, please set the Workbook.getSettings().setCheckCustomNumberFormat(boolean) method to true.

Check Custom Number Format when setting Style.setCustom(string) method

The following sample code assigns an invalid custom number format to Style.setCustom(string) method. Since we have already set the Workbook.getSettings().setCheckCustomNumberFormat(boolean) method to true, it throws an exception, e.g., “Invalid number format.” Please read the comments inside the code for more help.

Sample Code