Sorry,
I forgot to include the code that figures out the word document file length which is required for the byte array.
Also strDocumentFullName contains name of the word document ("C:\myfiles\testdoc.doc").
The complete code is as follows:
'*-------------------------------------------------------
'* Gets File Size.
'*-------------------------------------------------------
Dim oFile As System.IO.FileInfo
oFile = New System.IO.FileInfo(strDocumentFullName)
Dim oFileStream As System.IO.FileStream = oFile.OpenRead()
Dim intTotalBytes As Int32 = oFileStream.Length
oFileStream.Close()
'*-------------------------------------------------------
'* Read Word Document into Byte Array with Binary Reader
'* and convert Byte Array to string.
'*-------------------------------------------------------
Dim BR As New IO.BinaryReader(IO.File.OpenRead(strDocumentFullName))
Dim bArray(intTotalBytes) As Byte
bArray = BR.ReadBytes(intTotalBytes)
Dim strBuffer As String
strBuffer = System.Text.Encoding.Default.GetString(bArray)
BR.Close()
**********************************************************************
Sent via Fuzzy Software @
http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...