Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:57:42+00:00 2026-06-05T05:57:42+00:00

I am currently using the Word reference in C# to open and modify a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:57:43+00:00Added an answer on June 5, 2026 at 5:57 am

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In project i have reference to Microsoft.Office.Word.Server and in code i have method that
I am currently using VBA code which was originally intended for an excel document.
I am currently in the process of creating API documentation using Microsoft Word 2007
I am currently using PIL. from PIL import Image try: im = Image.open(filename) #
I'm currently using the validation code listed here in an application. I'd like to
I am currently using a javascript code to make an entire row in my
I am currently using isnumber to determine whether a specific word exist within a
I'm currently using Visual Studio 2010 Professional, and noticed the ability to create Word
I am currently using Apache FOP and have a stylesheet (possibly from RenderX) that
I am currently querying a table that has some null values scattered around. Without

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.