Opening a word doc from remote location thru http programatically which has image ,tables
Posted on 2004-10-12
i am facing some problem in opening a word doc from remote location thru http programatically which has images ,tables.
The code used for the functionality is as follows:
Stream = response.GetResponseStream
Dim str As StreamWriter
flePath = "c:\aspo\temp_ject.doc"
Dim s2 As FileStream
If fs.Exists(flePath) Then
fs = Nothing
Dim bryRead As System.IO.BinaryReader
bryRead = New System.IO.BinaryReader(stream)
Dim by(resnet.ContentLength) As Byte
Dim x As Integer : x = bryRead.Read(by, 0, resnet.ContentLength)
Dim bryWrite As System.IO.BinaryWriter
Dim fs2 As System.IO.FileStream
fs2 = New System.IO.FileStream("c:\aspo\temp_ject.doc", System.IO.FileMode.CreateNew, System.IO.FileAccess.Write)
bryWrite = New System.IO.BinaryWriter(fs2)
bryWrite.Write(by, 0, by.Length)
No problem in opening a normal imageless,tableless document using response object GetResponseStream() and saving it.
Problem is in having images,tables in the binary content of GetResponseStream. The file is getting saved and the file of same bytes, but unable to open in word application.
Is there anyother way to solve this issue.
Thanks in Advance,