0
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 is exist in two places in word doc :
1) table

QuestionTitle Issueno description Pageno Title 
    x            55      xyz 

Column values are given above of columns of table exist in word doc like
QuestionTitle =x,Issueno=55,description=xyz,Pageno and Title column are blank now.

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 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:

QuestionTitle Issueno description Pageno Title 
    x            55      xyz        3    1.2.1

Updated column values are given above of columns of table exist in word doc like
QuestionTitle =x,Issueno=55,description=xyz,Pageno=3 and Title=1.2.1

I am not able to find c# code to search text(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.
3
Contributors
2
Replies
5
Views
4 Years
Discussion Span
Last Post by NanaYee
0

I know you said VS 2005, .Net 2.0, but I found this link

http://omegacoder.com/?p=555

It's for 2010, 4.0, but it should be able to give you an idea. It's been awhile since I worked with office, but you'll be looking into something called Interop.

0

Search Text:

    Document document = new Document();
    document.LoadFromFile(@"..\..\test.doc");
    TextSelection[] textSelections = document.FindAllString("xyz.Text, true, true);

I use a C# Word DLL.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.