I was previously successfully saving a workbook using the HttpResponse save option but then started giving me a corrupted file in version v23.9.9 of Aspose.Cells in c#.
I also tried instead of using the HttpResponse save to save to a memory stream and then write that to disk and this file is Also corrupt.
HOWEVER if I just save to a file path with no save options the file is perfectly fine.
var response = context.HttpContext.Response;
using (var stream = new MemoryStream())
{
workbook.Save(stream, new XlsSaveOptions(SaveFormat.Xlsx));
stream.Position = 0;
System.IO.File.WriteAllBytes(@"c:\tempfolder\testing.xlsx", stream.ToArray());
}
this gives me a 5k file that is corrupt same as when trying to use
Perhaps my understanding of XlsSaveOptions is off?
var workbook = new Workbook();
workbook.Save(@"c:\tempfolder\testing.xlsx"); // this works
workbook.Save(@"c:\tempfolder\testing2.xlsx", SaveFormat.Xlsx); // this works;
workbook.Save(@"c:\tempfolder\testing3.xlsx", new XlsSaveOptions(SaveFormat.Xlsx)); // this breaks;
Is this a newer change? My code worked prior to the upgrade to the newer version. I CAN change it everywhere, but your coding example uses the same thing I was that is now breaking.
This is not a new change but a proper way when saving XLSX file format. And, yes, our coding example in the docs uses your mentioned thing and we will fix it soon.