How to resolve issues with maximum number of formats WinForms GridGroupingControl?
Resolve maximum number of formats exceeded exception.
Description:
The Maximum number of formats exceeded exception occurs when the Grid exports with the maximum number of styles and other formats (Excel 2003).
Solution:
You can resolve this issue by setting both the excel engine and workbook version as per your required excel version. As Excel 2003 supports only 4000 extended formats, you need to initialize the engine as 2007 or higher excel engine version.
C#
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;
//Specify your needed Excel version
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workBook = ExcelUtils.CreateWorkbook(1);
//Specify your needed Excel version
workBook.Version = ExcelVersion.Excel2013;
IWorksheet sheet = workBook.Worksheets[0];VB
Dim excelEngine As ExcelEngine = New ExcelEngine
Dim application As IApplication = excelEngine.Excel
'Specify your needed Excel version
application.DefaultVersion = ExcelVersion.Excel2013
Dim workBook As IWorkbook = ExcelUtils.CreateWorkbook(1)
'Specify your needed Excel version
workBook.Version = ExcelVersion.Excel2013
Dim sheet As IWorksheet = workbook.Worksheets(0)