We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Word upgrade not working with Save option with response

Hello,
We are using Aspose.Word from Aspose.word to generate Word document on server and sending same document in web response object using following Save function in vb.net and is working fine. We are using Aspose.word DLL version 10.8.0.0

Public Function OpenWordDocument(ByRef resp As System.Web.HttpResponse, ByVal OutputFile As String) As Boolean
Dim Ret As Boolean = False
Dim OutFile As String = DataAccess.CommonStatic.ExtractFilename(OutputFile)
Dim doc As Aspose.Words.Document = New Aspose.Words.Document(OutputFile)
Try
Dim asposeRet As Aspose.Words.Saving.SaveOutputParameters = doc.Save(resp, OutFile, Aspose.Words.ContentDisposition.Attachment, Nothing)
Catch ex As Exception
Log(ex.ToString())
Ret = False
Finally
End Try
Return Ret
End Function

I tried to upgrade Aspose.word DLL version to latest version 15.7.0.0 and matching function not found to send word as response object and unable to compile the project.

I tried following line to replace line bold from above function but it is giving zipped file instead of word document in an output response.

Public Function OpenWordDocument(ByRef resp As System.Web.HttpResponse, ByVal OutputFile As String) As Boolean
Dim Ret As Boolean = False
Dim OutFile As String = DataAccess.CommonStatic.ExtractFilename(OutputFile)
Dim doc As Aspose.Words.Document = New Aspose.Words.Document(OutputFile)
Try
'Dim asposeRet As Aspose.Words.Saving.SaveOutputParameters = doc.Save(resp, OutFile, Aspose.Words.ContentDisposition.Attachment, Nothing)
Dim asposeRet As Aspose.Words.Saving.SaveOutputParameters = doc.Save(resp.OutputStream, SaveFormat.Docx)
Catch ex As Exception
Log(ex.ToString())
Ret = False
Finally
End Try
Return Ret
End Function

I looked at Save methods from aspose.word and following 4 methods listing with latest version of aspose.word.dll (15.7.0.0)
(1) Public Function Save(fileName As String) As Aspose.Words.Saving.SaveOutputParameters
Member of Aspose.Words.Document
(2) Public Function Save(fileName As String, saveFormat As Aspose.Words.SaveFormat) As Aspose.Words.Saving.SaveOutputParameters
Member of Aspose.Words.Document
(3) Public Function Save(fileName As String, saveOptions As Aspose.Words.Saving.SaveOptions) As Aspose.Words.Saving.SaveOutputParameters
Member of Aspose.Words.Document
(4) Public Function Save(stream As System.IO.Stream, saveFormat As Aspose.Words.SaveFormat) As Aspose.Words.Saving.SaveOutputParameters
Member of Aspose.Words.Document
(5) Public Function Save(stream As System.IO.Stream, saveOptions As Aspose.Words.Saving.SaveOptions) As Aspose.Words.Saving.SaveOutputParameters
Member of Aspose.Words.Document

Please advise how to resolve this issue.

Appreciate your help
Akshay

Hi Akshay,

Thanks for your inquiry. Please read following article about sending document to client browser.
https://docs.aspose.com/words/net/save-a-document/

Please read the detail of Document.Save method from here:
https://reference.aspose.com/words/net/aspose.words/document/save/

Please let us know if you have any more queries.

Hi Tahir Manzoor,
The changing reference of Aspose,Word DLL from 3.5 to 2.0 folder fixed issue.

Thank you for help.
Akshay

Hi Akshay,

Thanks for your feedback. It is nice to hear from you that your issue has been resolved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

https://docs.aspose.com/words/net/save-a-document/