hello
i am trying to develope an application for word automation.i need to insert
header and footer to the document.
i found an exampke in msdn and used it in my application.it works well;but
when i add the code for inserting header;an error apear instead of header in
the document
the error is this:Error! Bookmark not defined.
and this is the piece of code i added for inserting header:
foreach (Word.Section section in oDoc.Sections)
{
object fieldEmpty = Word.WdFieldType.wdFieldEmpty;
object autoText = "HELLO THIS IS HEADER";
object preserveFormatting = true;
//section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Text
section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range.Fields.Add(
section.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range,
ref fieldEmpty, ref autoText, ref preserveFormatting);
}
what is this bookmark thing and what should i add to these line in order to
make my code work.
any information is appreciated
bluestar