Hello all,
I currently have a Word 2003sp2 VSTO solution that dynamically adds a customization which works fine. Now, I am trying the same thing with Excel 2003sp2 and I get the following error:
Microsoft.VisualStudio.Tools.Applications.Runtime.CannotLoadManifestException: Unable to retrieve the manifest from the document.
at Microsoft.Office.Tools.OfficeAppInfoDocument.EnsureDocument()
at Microsoft.Office.Tools.OfficeAppInfoDocument.WriteItem(String element, String id, Byte[] item)
at Microsoft.VisualStudio.Tools.Applications.Runtime.AppInfo.WriteManifest(IAppInfo appInfo, String manifest)
at Microsoft.VisualStudio.Tools.Applications.Runtime.Customizer.CustomizeDocument()
at Microsoft.VisualStudio.Tools.Applications.Runtime.Customizer.Customize()
at Microsoft.VisualStudio.Tools.Applications.Runtime.ServerDocument.AddCustomization(String documentPath, String assemblyName, String deploymentManifestPath, String applicationVersion, Boolean makePathsRelative)
Here is a sample of a quick test case that I am running:
[Test]
public void TestCustomizationForExcel()
{
string path = @"C:\home\MySpreadsheet.template.xls";
string assembly = @"C:\Documents and Settings\kjq\Local Settings\Application Data\test\templates\Office.Excel_1.0.0.0\Office.Excel.dll";
string manifest = @"C:\Documents and Settings\kjq\Local Settings\Application Data\test\templates\Office.Excel_1.0.0.0\Office.Excel.dll.manifest";
string version = "1.0.0.0";
bool isCustomized = ServerDocument.IsCustomized(path);
Console.WriteLine("IsCustomized: " + isCustomized);
ServerDocument.AddCustomization(path,assembly,manifest,version,false);
}
[Test]
public void TestCustomizationForWord()
{
string path = @"C:\home\NewDocument.template.doc";
string assembly = @"C:\Documents and Settings\kjq\Local Settings\Application Data\test\templates\Office.Word_1.0.0.0\Office.Word.dll";
string manifest = @"C:\Documents and Settings\kjq\Local Settings\Application Data\test\templates\Office.Word_1.0.0.0\Office.Word.dll.manifest";
string version = @"1.0.0.0";
bool isCustomized = ServerDocument.IsCustomized(path);
Console.Out.WriteLine("IsCustomized: " + isCustomized);
ServerDocument.AddCustomization(path,assembly,manifest,version,false);
}
If I run the project out of VS2005 the Excel document starts up and shows the customization in the properties but i need to dynamically attach it at runtime. I'm not doing anything currently with the Excel solution but trying to attach the customization so there is no other code involved. This is all running client-side also where I have MS Office and everything else installed (once again this works in Word for me).
Any help would be greatly appreciated.
Thanks.
KJQ