Getting System.NotSupportedException: packageFactory cannot

Posted by MBeynon on 21-Mar-2013 03:45

Hi,

I'm getting the above error when trying to do a LOAD from an .xlsx file with the Infragistics.Excel.Workbook component.

USING Infragistics3.Excel.v9.2.* FROM ASSEMBLY.
USING Infragistics3.Win.UltraWinGrid.ExcelExport.v9.2.* FROM ASSEMBLY.

DEFINE VARIABLE wb                AS Infragistics.Excel.Workbook                                      NO-UNDO.
DEFINE VARIABLE ws                AS Infragistics.Excel.Worksheet                                     NO-UNDO.


wb = Infragistics.Excel.Workbook:LOAD(lvcFileName).

As I understand it I either need to use the Infragistics3.Excel.v9.2 package to avoid this error or use the  IPackageFactory interface when loading the file.

I've ensured that the Infragistics3.Excel.v9.2 package is available to my project and is in the assemblies file used by my application but I still get the following error.

---------------------------
Error (Press HELP to view stack trace)
---------------------------
System.NotSupportedException: packageFactory cannot be null.
When loading from 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.
---------------------------
OK   Help  
---------------------------

.NET StackTrace:
-->   at Infragistics.Excel.Workbook.LoadXLSXFile(Workbook workbook, Stream stream, IPackageFactory packageFactory, Boolean verifyExcel2007Xml)
   at Infragistics.Excel.Workbook.LoadHelper(Stream stream, WorkbookFormat format, String parameterName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml)
   at Infragistics.Excel.Workbook.Load(String fileName, IPackageFactory packageFactory, Boolean verifyExcel2007Xml)
   at Infragistics.Excel.Workbook.Load(String fileName)

Does anyone know how I can address this issue as I need to be able to open .xlsx files as well as .xls.

Many Thanks,

Mark.

All Replies

This thread is closed