Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
XLSX export?
posted

 

Hi,

Actually I use the UltraWebGridExcelExporter (10.3 on ASP.NET 2.0) to export a grid to .xls using the following code:

 

this.xlsExport.DownloadName = "result.xls";
Infragistics.WebUI.UltraWebGrid.UltraWebGrid resultGrid = this.resGrid.GetGrid();
this.xlsExport.Export(resultGrid);


This works fine, but now I want to allow exporting to Office 2007+ file format .xlsx. If I just pass a DownloadName "result.xlsx", I will get a file "result.xlsx.XLS". :(

I've also tried to do the following:

this.xlsExport.DownloadName = "result.xlsx";
Infragistics.WebUI.UltraWebGrid.UltraWebGrid resultGrid = this.resGrid.GetGrid();
Infragistics.Excel.Workbook wb = new Infragistics.Excel.Workbook();
wb.SetCurrentFormat(Infragistics.Excel.WorkbookFormat.Excel2007);
this.xlsExport.Export(resultGrid, wb);

But then I get the following error:

Exception of type 'System.Web.HttpUnhandledException' was thrown.
Stack Trace:
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---> System.NotSupportedException: packageFactory cannot be null. When saving to Excel2007 workbook format and using the Infragistics2.Excel assembly, you must provide an IPackageFactory to handle the packaging of data. If you are using the DotNet Framework 3.0 or higher, use the Infragistics3.Excel assembly instead, and the packaging will be handled by the WindowsBase class

How to get that working?

 

Best Regards