0

I am using DocX library to modify a word file. I replaced a text in this document as follow:

using (DocX document = DocX.Load(@"E:\Test.docx"))
{
    document.ReplaceText("text", "replaced");
    document.Save();
}

But, texts in Footer of the file are not replaced. The question is How can I modify texts in the Footer of the docx file?

OmG
  • 18,337
  • 10
  • 57
  • 90

1 Answers1

0

You should replace texts of footer using Footer property for both even and odd likes the following:

// ...
document.Footers.odd?.ReplaceText("text","replaced");
document.Footers.even?.ReplaceText("text","replaced");

document.Save();
OmG
  • 18,337
  • 10
  • 57
  • 90