Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Tue Jun 11, 2024 7:57 am

Hello

what's the recommended way to save a workbook to stream and allow for more than 65536 lines?

I'm using this but it cuts off at 65536:

byte[] fileContent;
using (var ms = new MemoryStream())
{
workbook.SaveToStream(ms, FileFormat.Version2016);
fileContent = ms.ToArray();
}

Thanks

xel_wise
 
Posts: 16
Joined: Thu Sep 15, 2022 8:33 am

Tue Jun 11, 2024 8:18 am

Hello,

Thanks for your inquiry.
Kindly note that our Spire.XLS creates a workbook based on the Excel version 2003 by default when doing “new Workbook()”, and the 2003 version itself has the limitations of 65536 rows and 255 columns. However, you can set a higher version for workbook like the following code.
Code: Select all
//create a workbook
Workbook workbook= new Workbook();
//specify excel version
workbook.Version = ExcelVersion.Version2010;
...
workbook.SaveToStream(ms, FileFormat.Version2016);

If there is any other issues, just feel free to contact us.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 419
Joined: Mon Dec 27, 2021 2:23 am

Tue Jun 11, 2024 8:42 am

it works thank you!

xel_wise
 
Posts: 16
Joined: Thu Sep 15, 2022 8:33 am

Wed Jun 12, 2024 2:16 am

Hello,

Thanks for your feedback.
Glad to hear that news, if you have any further questions in the future, please feel free to write back.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 419
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.XLS