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
I believe you will need to change your references to Infragistics3 for both the Excel and the Wingrid Exporter assembly. Take a look at this forum thread:
http://es.infragistics.com/community/forums/p/50867/266761.aspx#266761
I am using Infragistics2.UltraGrid.Excel.v10.2 CLR 2x for WINFORMs. So need IpackageFactory implementation for this version.
Hello Renuka,
Thank you for the update. Please see the following documentation:
http://help.infragistics.com/NetAdvantage/WinForms/Current/CLR4.0/?page=Infragistics4.Win.UltraWinGrid.ExcelExport.v12.2~Infragistics.Win.UltraWinGrid.ExcelExport.UltraGridExcelExporter~Export(UltraGrid,String,WorkbookFormat).html
As you can see the export on the Windows Form exporter has an overload that allows you to set the WorkbookFormat.
Please let me know if you have any further questions concerning this matter.
Sincerely,Mike P.Developer Support Engineer IIInfragistics, Inc.www.infragistics.com
I am using Windows form. Can you please provide solution according.
Hello,
Thank you for your patience. The WebExcelExporter has a property called WorkbookForm that you can set to tell it what format to export in. If you set it to Excel2007 it will export as an xlsx. For example:
<ig:WebExcelExporter ID="WebExcelExporter1" runat="server" WorkbookFormat="Excel2007"> </ig:WebExcelExporter>
<ig:WebExcelExporter ID="WebExcelExporter1" runat="server"
WorkbookFormat="Excel2007">
</ig:WebExcelExporter>
Please let me know if you have any questions concerning this matter.