![Collapse image](collapse_all.gif)
![Expand Image](expand_all.gif)
![](collapse_all.gif)
![](expand_all.gif)
![](dropdown.gif)
![](dropdownHover.gif)
![Copy image](copycode.gif)
![CopyHover image](copycodeHighlight.gif)
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#
![](icons/CopyCode.gif)
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);