I want to read out the BuiltInDocumentProperties/CustomDocumentProperties of an Word document. The following Source always return null :-(
using Microsoft.Office.Core;
using Word = Microsoft.Office.Interop.Word;
.....
private void toolStripMenuItemTmp_Click(object sender, EventArgs e)
{
Word.Application word = new Word.Application();
Word.Document document = word.Documents.Open(@"C:\Users\fillibuster\Desktop\docproperty.docx");
DocumentProperties properties = (DocumentProperties)document.CustomDocumentProperties;
if (properties != null)
{
foreach (Microsoft.Office.Core.DocumentProperty item in properties)
{
MessageBox.Show(item.Name.ToString() + item.Value.ToString());
}
}
else
{
MessageBox.Show("null");
}
}
What's wrong with the source? CustomDocumentProperties and BuiltInDocumentProperties are available and filled in the document!