The dynamic Word documents was created in ASP.net and stream it through System.IO.MemoryStream.
I read the stream data from System.IO.MemoryStream and put it in a Zip file using Telerik Zip Archive Entry,
But the error of "The destination file could not be create" keeps popping out...please see my code below and
let me know what I missed....Please help me....thanks.
oResponse.Clear()
oResponse.AddHeader("content-disposition", "attachment; filename=Gerrytest4.zip")
oResponse.ContentType = "application/octet-stream"
Using memoryStream As New System.IO.MemoryStream
Using archive As New ZipArchive(memoryStream, ZipArchiveMode.Create, True, Nothing)
Using entry As ZipArchiveEntry = archive.CreateEntry(sSSPFilename)
Dim writer As New BinaryWriter(entry.Open())
oDocTemplate.Save(memoryStream, oFormat)
Dim sr As BinaryReader = New BinaryReader(memoryStream, System.Text.Encoding.UTF8)
memoryStream.Position = 0
writer.Write(sr.ReadBytes(memoryStream.Length))
writer.Flush()
End Using
End Using
oResponse.BinaryWrite(memoryStream.ToArray())
End Using