Click here to Skip to main content
Rate this: bad
good
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 asp.net.thank you!

 

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

novel
2013-1-10
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Hello,
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();
            document.LoadFromFile(@"..\..\..\DocSample.doc");
 
            //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.
Replace:
            document.Replace("TextString", "ReplaceString",true,true);
Write:
            Section section = document.Sections[0];
            Paragraph paragraph = section.AddParagraph();
            paragraph.AppendText("New String");
You can visit .NET Word project to get more information.
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 235
1 Sergey Alexandrovich Kryukov 120
2 Richard MacCutchan 100
3 ChauhanAjay 95
4 BotCar 95
0 Sergey Alexandrovich Kryukov 9,056
1 OriginalGriff 8,041
2 CPallini 2,613
3 Richard MacCutchan 2,221
4 Abhinav S 1,928


Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2014
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