I'm trying to edit a .docx header through Word Automation. If the Content Controls are placed in the body of the text there is no problem, but if the content controls are in the header or footer I'm not able to target them. Is there any way of targetting Content Controls in the header or footer (using Visual Studio 2008 Express)?
A:
Using Word Automation one way of targetting ContentControls in the header can be:
Dim ContControlCollec As Word.ContentControls
ContControlCollec = WordDoc.Doc.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage).Range.ContentControls
ContControlCollec.Item(1).Range.Text = Text1
ContControlCollec.Item(2).Range.Text = Text2
ac55
2010-08-10 14:11:40