recently I was trying to save Aspose.Cells.Workbook to stream with
private Stream GetWorkbook()
{
// processing workbook here
// ...
// saving to stream
return workbook.SaveToStream();
}
private void Save()
{
using (stream = GetWorkbook())
using (var fileStream = new FileStream(filePath, FileMode.Create, FileAccess.Write))
{
stream.CopyTo(fileStream);
}
}
But when I'm trying to open generated .xlsx file Excel sends me an error that file is corrupted.