在使用 Golang 通过 C++ 设置样式的自定义属性时检查自定义数字格式

可能的使用场景

如果你为 Style.GetCustom() 属性分配了无效的自定义数字格式,Aspose.Cells 不会抛出任何异常。但是,如果你希望 Aspose.Cells 检查所分配的自定义数字格式是否有效,请将 Workbook.GetCheckCustomNumberFormat() 属性设置为 true

设置 Style.Custom 属性时检查自定义数字格式

以下示例代码为 Style.GetCustom() 属性分配了无效的自定义数字格式。由于我们已经将 Workbook.GetCheckCustomNumberFormat() 属性设置为 true,因此会抛出异常,例如:无效的数字格式。请查看代码中的注释以获取更多帮助。

示例代码