Staff DotNet Blogs

Hi.  This is a note I want to publish here about something I discovered recently when programmatically accessing Content Controls located inside a Word 2007 document by using the Office Automation API (Office Interop Layer).

The Office Automation API provides a Document class which contains a ContentControls collection.  According to my expectations the ContentControls collection should include all of the content controls located inside the document, however, it doesn’t.  It does not include the content controls located inside text boxes (or any kind of shape added to the document).  So, if you want to get ALL OF THE CONTENT CONTROLS located inside a document you also need to traverse the Document.Shapes collection and look into the Range.ContentControls collection for each one of those shapes (besides traversing the Document.ContentControls collection).

Hope this helps.

Comments are locked for this post.