We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

workbook.SaveAs only saves to stream

Hello,

how do I save a workbook to disk in a console app?

If I use  the Syncfusion.XlsIO.Wpf package, workbook.SaveAs allows to save to disk by providing a path but if I use either  Syncfusion.XlsIO.NET  or Syncfusion.XlsIO.Net.Core all I'm offered is to save to a stream.

I can probably save the stream to disk by myself but it seems quite cumbersome. Why is there such a difference between these packages ?

I'm using the latest version ( 20.3.0.56 ) of all packages.



3 Replies

KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 11, 2022 04:10 PM UTC

We suggest you to use the Syncfusion.XlsIO.Wpf package in WPF applications. So, XlsIO can directly access the local file system and save the document. But, Syncfusion.XlsIO.NET and Syncfusion.XlsIO.NET.Core are portable packages that can be used in web and cross-platform applications where we cannot directly access the file system. For that, we have provided only support for saving the document as a stream. However, using.NET and.NET Core packages, you can save the document to the local file system by creating a file stream as shown below. 



FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite);

workbook.SaveAs(stream);

stream.Dispose();



JN Jean-Michel Nicolas replied to Konduru Keerthi Konduru Ravichandra Raju November 14, 2022 07:10 AM UTC

Thank you.



KK Konduru Keerthi Konduru Ravichandra Raju Syncfusion Team November 16, 2022 12:00 PM UTC

You are Welcome, Jean.


Loader.
Live Chat Icon For mobile
Up arrow icon