Convert byte[] to excel

hi I need to convert byte[] from database to excel in c#

Hi,


First, you have to use your own .NET code that would extract and fill into byte array from your datasource. Now, you may use Aspose.Cells for .NET APIs to load/open that byte array and save to Excel file formats accordingly.

See a sample code below for reference:
//…
// Your code goes here.
byte[] bytes = ______________;


MemoryStream ms = new MemoryStream();
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
Workbook workbook = new Workbook(ms);
workbook.Save(filePath + “.out.xlsx”);
workbook.Save(filePath + “.out.pdf”, SaveFormat.Pdf);

Workbook workbook = new Workbook(ms);


This statement return a error “Object reference not set to an instance of an object”.
I use the latest dll. Aspose.Cells for .NET 7.3.0

Hi,


Thank you for using Aspose.Cells.

Please elaborate your requirements to us in detail. It will give us a better idea about your requirements if you would share the complete portion of code that you are using, resulting in this exception.