Accessing Excel Custom Document Properties programmatically

If you are targetting .NET 4.0, you can use the dynamic key word for late binding

 Document doc = GetActiveDocument();
 if ( doc != null )
 {
     dynamic properties = doc.CustomDocumentProperties;
     foreach (dynamic p in properties)
     {
         Console.WriteLine( p.Name + " " + p.Value);
     }
 }

Leave a Comment