I am using Infragistics ver 11.1.20111.2111. I got an error when I tried to save a xslx workbook.
'Error: packageFactory cannot be null. When saving to Excel2007 workbook format and using the Infragistics2.Documents.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.Documents.Excel assembly instead, and the packaging will be handled by the WindowsBase class.'
I tried the method by replacing the infragistics2 excel assembly with the infragistc3 excel assembly.
On this line:
Me.UltraGridExcelExporter1.Export(Me.GrdTimeDisplay, wksheet, 0, 0)
I get the following error when I do that.
Error 1 Reference required to assembly 'Infragistics2.Documents.Excel.v11.1, Version=11.1.20111.2111, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb' containing the type 'Infragistics.Documents.Excel.Workbook'. Add one to your project. C:\Visual Studio 2013\Projects\Query Plus VS2013\QueryPlusCopyRightVS2013\QueryPlus\QueryPlus7_2\UI\WinForms\frmClaims.vb 2419 13 QueryPlus7_2
When I keep both the Infragistics2 and Infragistics3 Excel assemblies I get the following.
Dim oExcel As New Excel.Workbook
I get the following error.
Error 1 'Workbook' is ambiguous in the namespace 'Infragistics.Documents.Excel'. C:\Visual Studio 2013\Projects\Query Plus VS2013\QueryPlusCopyRightVS2013\QueryPlus\QueryPlus7_2\UI\WinForms\frmClaims.vb 2416 31 QueryPlus7_2
How do I fix this? Do you have an example of how to use the IPackageFactory Interface?
You cannot reference both the Infragistics2 and Infragistics3 version of the same assembly. That will not work.
But you need to replace the reference for more than just the Excel assembly. It looks like you are using the grid exporter. So at the very least, you will also need to update:
Infragistics3.Win.UltraWinGrid.ExcelExport.v11.1.dll (from Infragistics2.Win.UltraWinGrid.ExcelExport.v11.1.dll)
You may also need a couple of others. I forget if they are dependencies of the Excel engine in v11.1. So you probably only need to worry about these if you are already references to the "Infragistics2" versions in your project.
Thank you. That worked!