Using .NET 4, how do I add custom properties to a document?
I’m assuming it goes something like this:
WordApp // an instance of Microsoft.Office.Interop.Word.Application
.ActiveDocument
.CustomDocumentProperties
.Add...?
I cannot seem to find documentation for this that applies to .NET4/interops v14.
It took a lot of guessing (much more than 12 minutes worth, I’m embarrassed to say!) to figure this out:
I couldn’t find a decent enum for the types, so I dug the magic number “4” out of a forum post for
stringand it works…For casual browsers, this was tricky because
CustomDocumentPropertiesis dynamic, so I get no Intellisense. And for some reason, I cannot find docs on this.