Saves and returns the Excel files as a bytearray.
Note that the package is closed upon save
Namespace:
OfficeOpenXml
Assembly:
EPPlus (in EPPlus.dll) Version: 3.0.0.1 (3.0.0.1)
Syntax
| C# |
|---|
public byte[] GetAsByteArray() |
| Visual Basic (Declaration) |
|---|
Public Function GetAsByteArray As Byte() |
| Visual C++ |
|---|
public: array<unsigned char>^ GetAsByteArray() |
Return Value
[Missing <returns> documentation for "M:OfficeOpenXml.ExcelPackage.GetAsByteArray"]
Examples
Example how to return a document from a Webserver...
CopyC#
ExcelPackage package=new ExcelPackage(); /**** ... Create the document ****/ Byte[] bin = package.GetAsByteArray(); Response.ContentType = "Application/vnd.ms-Excel"; Response.AddHeader("content-disposition", "attachment; filename=TheFile.xlsx"); Response.BinaryWrite(bin);
