Save Excel file

174 Views Asked by At

I have a problem, because I am trying to save and excel Workbook in a determinate file path. I am using Universal windows and SpreadsheetGear to create the excel.

I know to open the excel project but i dont know to save it :(

Somebody knows to save excels or files in xamarin forms, in a determinate folder?

1

There are 1 best solutions below

0
ProgramacionFJ On

I find a solution to this problem, if enyone has the same problem, the code is the next (Remember that i am using XamarinForms (UWP) and SpreadsheetGear)

System.IO.MemoryStream stream = (MemoryStream)workbook.SaveToStream(SpreadsheetGear.FileFormat.OpenXMLWorkbook);

workbook.Close();

var folder_ = await StorageFolder.GetFolderFromPathAsync(@"C:\Excel_Modelo");
var file_ = await folder_.CreateFileAsync("Prueeeeba.xlsx",CreationCollisionOption.ReplaceExisting);

await FileIO.WriteBytesAsync(file_, stream.ToArray());