Click here to Skip to main content
12,830,941 members (37,896 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
hello everyone:
how can I search special cell in .doc file and write some word in it in you!

Posted 7-Jan-13 18:04pm
yizhiduxiunie 10-Jan-13 9:03am
how can I search special cell in .doc file if it have one more table? thank you!

Rate this: bad
Please Sign up or sign in to vote.

Solution 3

The special cell? Cell in Word table or just text in .doc file?
If you just want to search special text, the following code may be helpful.
            //load a document
            Document document = new Document();

            //Find text
            TextSelection[] textSelections = document.FindAllString("TextString", true, true);

For writing, you need to replace the found text if you want to write words in the same place. Or you can create a new paragraph to write words.
document.Replace("TextString", "ReplaceString",true,true);

Section section = document.Sections[0];
            Paragraph paragraph = section.AddParagraph();
            paragraph.AppendText("New String");

You can visit .NET Word project to get more information.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170326.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100