header visible after update range documentSection.Headers

M

Maurice

Hi,

I developed a Word Addin which applies some custom setting to the properties
of a set of Word document templates. I am currently encountering the
following issue.
After reading the custom properties I apply them to the document (generated
form the template) with the follwing code:

-------------------
foreach (Microsoft.Office.Interop.Word.Section documentSection in
doc.Sections)
{
documentSection .Range.Fields.Update()
documentSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Fields.Update();

documentSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage].Range.Fields.Update();

documentSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterEvenPages].Range.Fields.Update();
}
------------------
This works fine for templates WITH a visible header.
But if the template has NO header enabled (per default this is within the
doc but not visible), it is VISIBLE after the update of the headers part.....

Any ideas on how to prevent this unwanted behavior??

Regards

Maurice
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top