c# code to search text/string in word doc and get page number

Nov 20 2012 12:14 AM

I am using Visual studio 2005(.NET framework 2.0) .My project is window application and using c# language. We are having word templates created in office 2003, 2007 and 2010.

I want to search text (string) in word template (.dot/.doc/.docx).This text/string is exist in two places in word doc :

1) table

Question Title

Issue no

Change description

Page no

Title

Modified By

date

«QUESTION_TITLE»

«Issue_no»

xyz

«QUESTION_MODIFICATION_NAME»

«QUESTION_MODIFICATION_DATE»

 

2) title/subtitle

1.2.1 xyz

 

I want the page no and title/subtitle to copy into table of word doc.

For an example :  table is exist on page 1 and having column value as xyz under column Change description of word doc. Title/Subtitle 1.2.1 is exist on page no 3 with value xyz in word doc.

Now I want to update table by page no and title/subtitle of word doc:

Question Title

Issue no

Change description

Page no

Title

Modified By

date

«QUESTION_TITLE»

«Issue_no»

«QUESTION_MODIFICATION_DESCRIPT»

3

1.2.1

«QUESTION_MODIFICATION_NAME»

«QUESTION_MODIFICATION_DATE»

 

I am not able to find c# code to search text/string(xyz) in word doc and modify table with page no(3) and title(1.2.1) in word doc.

Please help me to find c# code.


Answers (1)