Free Support Forum -

Request to add "void Save(byte[]- FileFormatType)" method to Workbook

In our application, RAM consumption is seriously spiking. Part of the problem is that one library operates on byte[] and the other uses streams (Aspose.Cells). We are paying a penalty for the in-memory conversion.

Would you be willing to add an additional method to Aspose.Cells.Workbook that has the following signature?

public void Save(byte[ ] byteArray, FileFormatType fileFormatType);

Thank you for considering our request.

Of course, this solution would work for us only if the implementation of the Save method did not do the same type of conversion that we are doing. :slight_smile:

I don't think we can directly save the output file on byte array. If you need a byte array, you have to use MemoryStream.ToArray method to get it.

That’s what I am currently doing. I am trying to avoid the MemoryStream->byte[] conversion when trying to send the in-memory representation of the Excel document to another library. This other library transparently saves the data to a network share without my having to consider any network authentication issues, or even know exactly what share it is saved to.

We have to save file to a MemoryStream because:

1. It's very diffcult to calculate the byte array size before saving.

2. If we calculate the size, this action will degrade the performance.

I think saving to a MemoryStream and convert it to a byte array won't consume much more memory.

We are manipulating 50 Mb Excel files (worst case) and have seen "out of memory" errors on machines with 1 Gb total available physical RAM. The "out of memory" occurs on the Save operation. Aside from other options that we can pursue, I was expecting that avoiding the data-type transformation step would help.

I understand that this is not an Aspose problem. We were hoping that an additional API would help alleviate our RAM issues.

This is a tip that may help you shape your program to minimize memory usage: .

I got this error when I tried to save the excel file. This error strangely does not occur in development machines (xp os) but on servers. Any idea??

General Information: 1 : Timestamp: 10/20/2006 8:52:35 AM
Message: System.OutOfMemoryException: Out of memory.
at System.Drawing.Graphics.FromHdcInternal(IntPtr hdc)
at System.Drawing.Font.GetHeight()
at Aspose.Cells.ລ.ຩ(Font ԥ)
at Aspose.Cells.ລ.ວ(Graphics ל, Style ӧ, String Յ, Single Ӯ, Int32 ຢ)
at Aspose.Cells.ລ.ສ(Graphics ל, Cells Ө, Int32 خ, Int32 د, Int32 ؕ, Int32 ؖ)
at Aspose.Cells.ລ.຦(Cells Ө, Int32 خ, Int32 د, Int32 ؕ, Int32 ؖ)
at Aspose.Cells.Worksheet.AutoFitRow(Int32 startRow, Int32 endRow, Int32 startColumn, Int32 endColumn)
at Aspose.Cells.Workbook.Ծ()
at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)
at mbs2_invoice_service.Mbs2InvoiceExcel.UploadFile(Workbook& wb) in C:\vstfs\MBS2\mbs2_invoice\mbs2_invoice_service\Mbs2InvoiceExcel.cs:line 107
Category: General
Priority: -1
EventId: 1
Severity: Information
Machine: SNGMCMS01
App Domain: mbs2_invoice_service.exe
ProcessId: 5556
Process Name: C:\mbs2\InvoiceService\mbs2_invoice_service.exe
Thread Name:
Win32 ThreadId:3400
Extended Properties:

1. Which version of Aspose.Cells are you using?

2. Which file format do you specify when you call Workbook.Save method?

3. It seems that a font is not installed in your server. Could you please send your file created on xp development machine to Thank you.