iPackageFactory exception in workbook.Save method call

Answered (Verified) This post has 1 verified answer | 10 Replies | 5 Followers Thread's RSS feed.

cpaul
Points 430
Replied On: Thu, Jan 6 2011 10:14 PM Reply

I used some sample code I found on the Infragistics web site to write a group of DataTables to an Excel spreadsheet workbook in Excel 2007 format, with separate worksheets for each DataTable. However on the workbook.Save (fileName) method call, I get an exception that states:

"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"

I'm creating a WinForm client application targeting .NET 3.5. I have installed the latest version of Infragistics 10.3 WinForm libraries and I have no Infragistics3.Excel assemblies available, only Infragistics2.Excel assemblies show up.

Where can I find the Infragistics3.Excel assembly referred to in the exception?

If it is not available, then how do I create a simple default IPackageFactory similar to the one that you've implemented in your Infragistics3.Excel assembly.

Thanks for any suggestions or help you can provide.

  • Post Points: 20

Verified Answer

Mike Saltzman
Points 435,015
Infragistics Employee
Answered (Verified) Replied On: Fri, Jan 7 2011 9:47 AM Reply
Verified by cpaul

You project reference are referencing Infragistics2.Excel instead of Infragistics3.Excel. You just have to remove the former and add the later. They are both installed with NetAdvantage. Just right-click on the project references in Visual Studio and select "Add Reference" and then choose Infragistics3.Excel from the list.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 40

All Replies

Mike Saltzman
Points 435,015
Infragistics Employee
Answered (Verified) Replied On: Fri, Jan 7 2011 9:47 AM Reply
Verified by cpaul

You project reference are referencing Infragistics2.Excel instead of Infragistics3.Excel. You just have to remove the former and add the later. They are both installed with NetAdvantage. Just right-click on the project references in Visual Studio and select "Add Reference" and then choose Infragistics3.Excel from the list.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 40
cpaul
Points 430
Replied On: Mon, Jan 10 2011 12:03 PM Reply

Thanks for the clarification - I should have realized the answer myself. I hadn't installed both versions, which is why I had only seen the .NET 2.x compabile version of the Infragistics assemblies.

Upgrading is a simple solution to my problem - appreciate the response.

 

  • Post Points: 20
Mike Saltzman
Points 435,015
Infragistics Employee
Replied On: Tue, Jan 11 2011 9:40 AM Reply

cpaul:
I hadn't installed both versions

I was not aware that the installer even gives you the option to install one or the other. I thought they both installed automatically.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
cpaul
Points 430
Replied On: Wed, Jan 12 2011 10:04 AM Reply

I think I'm confused.

Based on your original comments I had thought that there were two entirely different versions of the WinForm 10.3 libraries, one with all module names Infragistics2.xxx, where all modules are .NET 2.0 compatible - and another set with duplicate modules, all with names Infragistics3.xxx that were .NET 3.5 compatible.

However if I look at my installation "Bin" folder, I only have two WinForm Infragistics3.xxx assemblies available:

Infragistics3.Excel.v10.3.dll and Infragistics3.Win.UltraWinGrid.ExcelExport.v10.3

So are these the only .NET 3.5 specific assemblies that you have created for the WinForm library?

  • Post Points: 20
Mike Saltzman
Points 435,015
Infragistics Employee
Replied On: Wed, Jan 12 2011 10:44 AM Reply

Hi,

That's correct, it's just those two assemblies which are available in CLR2 and CLR3. All of the others are CLR2.

The reason for this is that the Excel assemblies need packaging support in order to handle exporting to Office2007 format. This support is only available in CLR3.

But updating all of the other assemblies to CLR3 would mean that they would not be usable in CLR2, so we didn't want to limit their use.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
polfi
Points 1,220
Replied On: Tue, Jan 18 2011 3:20 PM Reply

Hi all!

Have the same problem. Removing the old excel2 and add the Excel3 causes some strange errors:

Me.UltraGridExcelExporter1.DefaultWorkbookPaletteMode = Infragistics.Excel.WorkbookPaletteMode.StandardPalette

is not longer working (Text translated: via google ;-(:

Error 3 on the assembly "Infragistics2.Excel.v9.2", the "Infragistics.Excel.WorkbookPaletteMode" includes, reference is made indirectly. Add the project reference to a file "C: \ Program Files \ Infragistics \ NetAdvantage 2009.2 \ windows forms \ bin \ Infragistics2.Excel.v9.2.dll" added

)

Also

exporter.Export(locGrid, xFile.Worksheets(0))

gives me an error (worked fine with Excel2)

rgds

Wolfgang

 

  • Post Points: 20
Mike Saltzman
Points 435,015
Infragistics Employee
Replied On: Tue, Jan 18 2011 4:56 PM Reply

Hi Wolfgang,

The error message here clearly indicates that your application is still reference the Infragistics2.Excel assembly.

Make sure you are using Infragistics3 for both the Excel and the Wingrid Exporter assembly.

If you have more than one project in your solution, make sure you check all of the projects.

Also, open up the license.licx file for your project(s) and delete the contents of that file, in case it's referencing the wrong assemblies.

Mike Saltzman

Manager - Windows Forms Development

Infragistics, Inc.

  • Post Points: 20
dss2007
Points 175
Replied On: Thu, Feb 2 2012 12:05 PM Reply

Hello Mike,

we using 8.3, does it work as well ? I replaced all references to Infragistics2.Win.UltraWinGrid.ExcelExport.v8.3 and Infragistics2.Excel.v8.3.dll with Infragistics3.*, rebuilt all projects but I am receiving this error when I try export grid with 66 k rows:

Fail: Can't export more rows than MaxExcelRowCount. Use FileLimitBehaviour property if you want to change default behaviour. 

I call

_excelExporter.Export(ug, filename,Infragistics.Excel.

 

WorkbookFormat.Excel2007);

and the filename has xlsx extension.

Do I need to do something else?

Thanks.

Regards.

Jan

 

  • Post Points: 20
Replied On: Fri, Feb 3 2012 2:44 AM Reply

Hello Jan,

Could you please try this out with the latest service release of version 8.3 - '2138' and let me now if it worked for you.


Best regards,

Boris

Developer Support Supervisor, MCPD
Infragistics, Inc.

How to get answers =>

  • Post Points: 20
dss2007
Points 175
Replied On: Wed, Feb 8 2012 8:13 AM Reply

Hello Boris,

yes it worked, thank you for the hint.

Is there a list of changes since build 8.3 - 1009 ?

Just to know what we should retest in our application.

Regards,

Jan

 

 

  • Post Points: 5
Page 1 of 1 (11 items) | RSS