dseaver
IS-IT--Management
- Jul 13, 2006
- 467
I am trying to create a word doc via code. I am trying to get a footer to appear on all pages other than the cover, but no matter what I've tried, I can't seem to get it to work. Here is my code for the footer:
wdHeaderFooterPrimary is supposed to only the following pages and wdHeaderFooterFirstPage takes care of the first page. I added a second section to see if that changed things and it still didn't help. Any ideas?
Code:
foreach (Microsoft.Office.Interop.Word.Section wordSection in _Doc.Sections)
{
if (wordSection.Index == 2)
{
wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary]
.Range.Font.Name = "Arial";
wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary]
.Range.Font.Size = 8;
wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary]
.Range.Text = "Foorter Text.";
}
wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterFirstPage]
.Range.Text = "";
}