Free Support Forum - aspose.com

Excel workbooks with customizations

Hi

I have created a simple customized Excel Smart Document using Microsoft Visual Studio Tools for Office 2005 (VSTO). Now I would like to make changes to the document using Aspose.Excel.

The document with its customization works fine until I open it using Aspose. I can load it into the .NET code without problems, but when save it and afterwards open it using Excel, the customization fails to load.

Have you had any experience in loading VSTO customized workbooks? Does Aspose support these documents?

It might just be an error in my code, but I believe the customization in a workbook, is just a reference to a manifest file, which points to the customization DLL.

Thanks in advance,

Henrik

Dear Henrik,

Could you please post your sample file here? I will check it. I think this is new features in Office2005.

Dear Laurence

Actually, it is a feature of Office 2003, which started with .NET 1.1 and has been improved in .NET 2.0. I have attached a sample workbook with its customization DLL. It requires .NET 2.0 and VSTO runtime installed on the PC, and the DLL requires full trust, otherwise it must be installed in the global assembly cache.

The only thing I do in Aspose is listed below - after this code is executed, my workbook no longer loads its customization:

Aspose.Excel.Excel book = new Aspose.Excel.Excel();
book.Open(filename);
book.Save(filename);

I know that this scenario is way off your support area, but here are the sample files anyway. Any help is appreciated. If you are interested, this MSDN site explains how to programmatically attach customizations to a workbook. I can also upload the Visual Studio solution files if you are interested.

Thank you
Henrik

Ups... here is the attachment.

/Henrik

Hello again

I found a work around. If I remove the custom properties identifying the customization/extension, and then add them again (as shown below), it works just fine, so you can close this support thread.

Excel book = new Excel();
book.Open(fileName);
book.Worksheets.CustomDocumentProperties.Remove("_AssemblyName");
book.Worksheets.CustomDocumentProperties.Remove("_AssemblyLocation");
book.Worksheets.CustomDocumentProperties.Add("_AssemblyName", "*");
book.Worksheets.CustomDocumentProperties.Add("_AssemblyLocation", @"C:\MySmartDoc.application");
book.Save(fileName);

However, in a future release it would be cool to have a function like
AddCustomization(string assembly_name, string assembly_location)
which then adds the custom document properties like described in the MSDN link I posted in the first message.

Thank you
Henrik