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.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
Enables storage, such as cookies, related to analytics.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.