Good morning,
i am using ASP.NET and i am using HTML Editor to Generate Html Text and convert it to word,
there is any way to download this word file on client machine without save it on server machine.
Thanks and best regards,
Hi Sam,
Thanks for your inquiry. In order to send a document to a client browser, use a special overloaded method Document.Save Method (HttpResponse, String, ContentDisposition, SaveOptions).
Please let us know if you have any more queries.
Hi Manzoor,
Dim doc As New Document()
Dim builder As New DocumentBuilder(doc)
Dim html As String = Literal1.Text
builder.InsertHtml(html, False)
dim docStream As MemoryStream = New MemoryStream()
doc.Save(docStream, Aspose.Words.saveFormat.Docx)
httpContext.Current.Response.Clear()
httpContext.Current.Response.ContentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=test.docx")
Dim bytes() As Byte = docStream.ToArray()
HttpContext.Current.Response.BinaryWrite(bytes)
HttpContext.Current.Response.End()
Thanks for your cooperation and best regards,
Hi Sam,
Thanks for your inquiry. Please use Document.Save method as shown below in your application. Hope this helps you.
Dim doc As New Document(MyDir + "in.docx")
Dim options As New OoxmlSaveOptions()
options.SaveFormat = SaveFormat.Docx
' Send the document in Docx format to client browser.
doc.Save(Response, "output.docx", ContentDisposition.Attachment, options)
Response.End()
Hi Manzoor,
it’s solved.
Thanks for your cooperation,
Best regards,