Hi,
Did any one worked on Open, Read and Find a particular string from documents (like .txt, doc, .html, .pdf etc...) using asp.net.
suthish nair:
Did any one worked on Open, Read and Find a particular string from documents (like .txt, doc, .html, .pdf etc...) using asp.net.
You can use the System.IO.File class to read files into byte arrays or plain text string etc
Hi,
There are some suggestions as below If they can help you.
If you have a few files and only do this kind of check once in a while, you have to use System.IO and open the files to check if the strings are in the files.
StreamReader fileStream =new StreamReader("your filename", System.Text.Encoding.Default);string Content = fileStream.ReadToEnd(); fileStream.Close(); int index= Content.IndexOf("your finding string"); If you need to do this kind of check repeatedly, please consider to use index services and full-text search.tanx friends, let me start with it.
try this...
System.IO.StreamReader tr =new System.IO.StreamReader(FileUpload1.PostedFile.FileName); // or type the path of ur file
String aString = tr.ReadToEnd();
tr.Close();
... to find a string in a string... may read this...http://msdn2.microsoft.com/en-us/library/aa904285(VS.71).aspx
0 comments:
Post a Comment