Click here to Skip to main content
12,241,975 members (47,057 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 asp.net.thank you!




novel
2013-1-8
Posted 7-Jan-13 18:04pm
Comments
yizhiduxiunie 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
Top Experts
Last 24hrsThis month


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