I can't find the example on to configure v2008.3 to allow the Excel functionality to be used in .NET 2.0.
I would like to use this functionality but am required to use .Net 2.0.
Is there a post describing the configuration?
Hi,
You can export the grid to Excel or use the Excel assembly to create Excel files in CLR2.0. The only limitation is that you cannot create Excel 2007 files - you have to use the older Excel2003 format.
If you want to use Excel2007, then you need to have a way to package the Excel files. CLR3.5 has assemblies that will do this for you. If you don't have access to those assemblies, then you would need to either write your own or use some other 3rd-party packaging assemblies. There is a sample included with the NetAdvantage SDK that demonstrates how this can be done. The sample, uses the CLR3.5 assemblies, since it obviously does not have access to any 3rd-party utlities. So you would need to replace the references to those CLR3.5 assemblies with whatever 3rd-party tool you are using.
The sample is called "Excel 2007 Custom Packaging" and it's under the WinMisc samples.
Where can I find the samples that you are referring to? The samples in NetAdvantage 2009.1 do not include the "Excel 2007 Custom Packaging" sample that you are referring to.
Regards,
David
Hi Valentina,
You need indeed to create a class that implements IPackagefactory.
To find the sample, you must download and install Infragistics NetAdvantage samples.
Then, the sample you should use is into WinMisc\CS\Excel 2007 Custom Packaging CS.
I've been using it for months and it seems to work.
Hope that helps
regards.
Dialogues
Hi Dialogues,
and so you're using the Infragistics sample as is? 'cause it's a bit strange: it targets .NET Framework 2.0, but it requires as a reference an assembly that comes with 3.0 installation: WindowsBase.dll ('Copy Local' is set to false, so this will not be deployed with the application...).
Are you sure your users can use your app's Excel functionality simply having .NET Framework 2.0 installed?
Thank you and sorry for the many questions... bye! Valentina
Yes, I use it as is, it surprised me the same way as you've been surprised... but it works (I believe) only usig the CLR2.0.
In fact I think you made a mistake because the WindowsBase.dll that is referenced is using the Runtime v2.0 but the version of the dll is 3.0...
I think the dll is not to deploy because it's part of the framework.
There's no way Infragistics can supply an example of implementing your own IPackageFactory in any real way, because it would require some third-party packaging utility. So the sample that is included demonstrates using an IPackageFactory with the packaging support built-in to CLR3. It uses CLR3 because the same can only demonstrate implementing the interface, not the actual packaging. So if you intend to implement your own packaging, you either need a third-party packaging utility or you have to write your own packaging routines to package the data in a way that is compatible with Excel.
Hi Mike,
I really don't understand why a third-party utility should implement an Infragistics-defined interface... There's no documentation available on what the implementing object should do... If you provide a method to load an Excel document, what should the object do?
Dialogues, I can tell you for sure that on a pure .NET 2.0 environment the Infragistics sample won't work. So the best choice is to deploy WindowsBase.dll with your application (but it sound really strange, since - you're right - it's a part of the framework...).
Bye, Valentina
I am not saying that some third party component should implement the interface.
In order to create a file compatible with Excel 2007 format, the file has to be packaged. CLR 3 provides built-in packaging functionality, so if you are using CLR3, the Infragistics Excel assemblies can utilize this in order to create Excel files for you.
But if you are using CLR2, then there is no support for packaging. Therefore, the Infragistics components cannot create an Excel file.
So.. in order to allow you the possibility of creating an Excel file in CLR2, the Excel assembly exposes an interface that you can implement so that you can do the packaging yourself. You could, theoretically, write your own packaging routines to packages the files. Or, you could use some other 3rd-party packaging utility.
Then, when the interface is called to package the file, you could handle the packaging however you want since the Infragistics components are unable to do it.
The sample provided is a sample of how to use the interface. Once again, since there is no support in the CLR2 framework to package the files, and the sample can't reply on any third-party software, it uses the CLR3 packaging functionality for demonstration purposes. All it's intended to demonstrate is that when the interface methods are called, it's up to you to package or un-package the files.