O
Oozle_Finch
Hello all,
I am trying to read from a Word document which is written in Japanese. I
have figured how to read a .txt document without problems, but when I read a
Word document the result comes out all garbled. I am posting the code that I
use below to read from the text files in hopes that someone can explain how
to use it for Word documents:
Dim fs As New FileStream("E:\DESKTOP\My_Japanese_File.doc",
FileMode.Open, FileAccess.Read)
'declaring a FileStream to open the file named *.doc with
"shift_JIS" encoding
Dim d As New StreamReader(fs, System.Text.Encoding.GetEncoding(932))
'creating a new StreamReader and passing the filestream object fs as
argument
d.BaseStream.Seek(10, SeekOrigin.Begin)
While d.Peek() > -1
'peek method of StreamReader object tells how much more data is
left in the file
RichTextBox1.Text &= d.ReadLine()
'displaying text from doc file in the RichTextBox
End While
d.Close()
Any help or guidance would be extremely appreciated !
Regards,
Jeremy
I am trying to read from a Word document which is written in Japanese. I
have figured how to read a .txt document without problems, but when I read a
Word document the result comes out all garbled. I am posting the code that I
use below to read from the text files in hopes that someone can explain how
to use it for Word documents:
Dim fs As New FileStream("E:\DESKTOP\My_Japanese_File.doc",
FileMode.Open, FileAccess.Read)
'declaring a FileStream to open the file named *.doc with
"shift_JIS" encoding
Dim d As New StreamReader(fs, System.Text.Encoding.GetEncoding(932))
'creating a new StreamReader and passing the filestream object fs as
argument
d.BaseStream.Seek(10, SeekOrigin.Begin)
While d.Peek() > -1
'peek method of StreamReader object tells how much more data is
left in the file
RichTextBox1.Text &= d.ReadLine()
'displaying text from doc file in the RichTextBox
End While
d.Close()
Any help or guidance would be extremely appreciated !
Regards,
Jeremy