Click here to Skip to main content
15,920,217 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to read text from .doc file ''Which is contain some email address like 'abc@gmail.com' and write into .text file in same format .

for this I had code as following.. to read data into binary and write into text file as text after convert into text , but it is not giving me correct response.
What is wrong with it please guide........


Dim FILE_NAME As String = C:\Users\Owner\Documents\test.Doc


Dim StringReader() As String

Dim finStream1 As New IO.FileStream(FILE_NAME, IO.FileMode.Open, IO.FileAccess.Read)
Dim fStream1 As New IO.FileStream("C:\Users\prakash\Desktop\EmailTEst.text, IO.FileMode.Create, IO.FileAccess.Write)

Dim br As New IO.BinaryReader(finStream1, System.Text.Encoding.UTF8)
Dim bw As New IO.StreamWriter(fStream1)
Dim byteRead As Byte
br.BaseStream.Seek(3, IO.SeekOrigin.Begin)
Dim strstring As String = ""
While br.ReadByte > 0
byteRead = br.ReadByte
strstring = strstring & Char.ConvertFromUtf32(byteRead)
bw.Write(strstring)
End While
br.Close()
bw.Close()

Thanks for your advice to improve my question.
Posted
Updated 17-Jul-12 21:20pm
v3
Comments
Karthik Harve 18-Jul-12 2:58am    
[Edit] Pre tags added.
OriginalGriff 18-Jul-12 3:01am    
"it is not giving me correct response"
Is not very helpful. we don't know what it is giving, or what you expect it to give.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.

1 solution

it won't - doc files aren't stored in a readable form

You'll have to use word automation - example here Word Automation using VB.NET - Part I[^]
 
Share this answer
 
Comments
ParkashKaur 18-Jul-12 3:48am    
Thanks for your advice it is quit help full for me.

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900