I am currently using the Word reference in C# to open and modify a word document. Some of the content that needs to be modified is in the headers, and am using the following code to account for that.
foreach(Range rng in doc.StoryRanges){
rng.Find.Execute(ref findVar, ref isTrue, ref isTrue, ref isFalse,
ref isFalse, ref isFalse, ref isTrue, ref isOne,
ref isFalse, ref replaceVar, ref isTwo, ref isFalse,
ref isFalse, ref isFalse, ref isFalse);
}
The issue is that my document has two unique headers. The first is comprised of the first 4 pages, and then on the 5th page it is a different header. It is marked in Word as “Header -Section 2-“. I have not been able to find a code snippit that will allow me to make any modifications in this second header.
Any guidance would be greatly appreciated.
I was able to find a code snippit at this site that is able to do a find and replace throughout the entire document: http://www.wwco.com/~wls/blog/2010/07/03/find-and-replace-in-word-using-c-net/
This will iterate through all parts of the document, so no parts are missed.