I am able to download using workbook.save on my local, but not able to download

How can I download the generated excel file using Aspose.cells library. I am able to save file on my local folder but how can I download on a click on some button. using c#.
Please help

@Amar_Srivastava,
You can download a file by saving it to response object. See the document with examples:

Let us know your feedback.

@Amar_Srivastava Contentdisposion of type aspose.cells is giving error. Only using mime namespace is accepted … how can we use the save() method with response object?

@Skrishnan,

See the document with example code for your reference:

Please try using latest version of the APIs. If you still find any issue, kindly provide more details with sample project and resource file(s) to reproduce the issue. Do you use .NET Standard/.NET Core project?

I am using .Net core Project.
image.png (63.0 KB)
image.png (2.7 KB)
I am using 22.3 Version

@Skrishnan,

Thanks for the screenshots.

Please note, “System.Web.HttpResponse” class only exists in (regular) .NET frameworks, Please note, .NETStandard/NET Core or later versions do not contain the class i.e., “System.Web.HttpResponse”. So we removed the relevant Workbook.Save() overloaded(s) in Aspose Cells for .NET Standard/.NET Core or in newer versions.

We suggest you to kindly try using:
public void Save(Stream stream, SaveOptions saveOptions) for saving workbook to a stream, then you may add an HttpHead ahead of the stream by yourselves. See the Note section with example code for further reference.

Hope, this helps a bit.

1 Like