-1

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?

DarkBee
  • 16,592
  • 6
  • 46
  • 58

1 Answers1

0

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());