This project has moved and is read-only. For the latest updates, please go here.

Microsoft Word Viewer using DocX and C#

Apr 7 at 5:18 PM
Hi,
I'm looking for a code to view my word doc and when i select specific section i will able to get the section text.
Thanks.
S.Atmane
Apr 11 at 2:19 AM
Edited Apr 11 at 2:21 AM
I don't have code on me but the process is fairly simple:
  1. Load the document.
  2. Read each paragraph in the document (I assume the section ID you are searching for is defined in text) and find the start of a section in the paragraph text.
    a. Once you have found the start of a section, add each paragraph to a separate list that you have defined earlier.
    b. Keep reading more paragraphs until you find the end of the section ID, or you reach the end of the document.
  3. Now iterate through your list of paragraphs mentioned in step 2, and change/select them as you wish.
By looking at the source code you will be able to see how to access paragraphs in the document, and the text inside each paragraph.