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

Save as csv in xlsIO

When I use your online instructions, I am getting an error "Argument 1: cannot convert from 'Windows.Storage.StorageFile' to 'System.IO.Stream' when trying to save a sheet (shData) as a csv.

var saveMain = await ApplicationData.Current.LocalFolder.CreateFileAsync("Test.csv", CreationCollisionOption.ReplaceExisting);
await shData.SaveAsAsync(saveMain, ",", Encoding.UTF8); 

Any advice?

Thanks.

2 Replies

GP Gary Pansino March 16, 2013 03:59 PM UTC

I had also tried  shData.SaveAs(saveMain, ",", Encoding.ASCII); and both SaveAs and ASCII are not recognized as keywords.


MK Manoj Kumar G M Syncfusion Team March 19, 2013 10:44 AM UTC

Hi Gary Pansino,

Thank you for choosing Syncfusion products.

Currently we don’t have support for passing  StorageFile as an argument for saving CSV files. Please use the following code snippet to achieve the above scenario.

Code Snippets:

StorageFile storageFile = await ApplicationData.Current.LocalFolder.CreateFileAsync("Test.csv");

            await sheet.SaveAsAsync(await storageFile.OpenStreamForWriteAsync(), ",", System.Text.Encoding.UTF8);

 

Please let us know if you any further clarifications.

Regards,

Manojkumar.


Loader.
Live Chat Icon For mobile
Up arrow icon