Saving File to Response Object with Golang via C++
Contents
[
Hide
]
Aspose.Cells makes it possible to manipulate files. This article explains the various ways in which files can be saved to a response object.
Saving File to Response Object
It is also possible to generate a file dynamically and send it directly to a client browser. In order to do so, use a special overloaded version of the Save method that accepts the following parameters:
- HttpResponse object.
- File name.
- ContentDisposition, the content‑disposition type of the output file.
- SaveOptions, the file format type.
The ContentDisposition enumeration determines whether the file being sent to the browser provides the option to open directly in the browser or in an application associated with .xls/.xlsx or another extension.
The enumeration contains the following pre‑defined save types:
| Type | Description |
|---|---|
| Attachment | Sends the spreadsheet to the browser and opens it in an application as an attachment associated with .xls/.xlsx or other extensions |
| Inline | Sends the document to the browser and presents an option to save the spreadsheet to disk or open it inside the browser |
XLS Files
XLSX Files
PDF Files
Note
Due to the object System.Web.HttpResponse not being included in .NET 5 and .NET Standard, this function does not exist in Aspose.Cells .NET 5 and .NET Standard versions. You can refer to the following code to save the file to a stream and then operate on the stream.