F
Fred Woolsey
My question is as follows:
The following code in a static utility method---
[snip]
return ((Office.DocumentProperties)doc.CustomDocumentProperties)[name].Value;
[/snip]
---works just peachy when called from within a C# Word template
(document-level) customization, but throws a COM "Invalid Cast" exception
when called from the Windows Forms application that opened/created the
document with the associated document-level customization (created, that is,
by the Application.Documents.Add(customizedTemplateName) method). In both
cases the utility method is in a static class in a referenced project.
Is something lost when going from doc = VSTO ThisDocument.InnerObject within
a VSTO doc-level customization to doc = Word.DocumentClass.ThisDocument in a
..NET forms application?
Thanks
The following code in a static utility method---
[snip]
return ((Office.DocumentProperties)doc.CustomDocumentProperties)[name].Value;
[/snip]
---works just peachy when called from within a C# Word template
(document-level) customization, but throws a COM "Invalid Cast" exception
when called from the Windows Forms application that opened/created the
document with the associated document-level customization (created, that is,
by the Application.Documents.Add(customizedTemplateName) method). In both
cases the utility method is in a static class in a referenced project.
Is something lost when going from doc = VSTO ThisDocument.InnerObject within
a VSTO doc-level customization to doc = Word.DocumentClass.ThisDocument in a
..NET forms application?
Thanks