V23.9.9 Workbook saved with XlsSaveOptions vs the SaveFormat Signature are corrupt and a different size

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

workbook.Save(httpResponse, “testing.xlsx”, ContentDisposition.Attachment, options, true);

But this will give a good file
Snippet

workbook.Save(@“c:\tempfolder\testing.xlsx”);

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;

This is doing the same save with XlsSaveOptions, but that gives me a different file size and one that is corrupt.

image.png (17.6 KB)

@AndyC2C,

Please try the following line(s) instead, it should work fine:

workbook.Save(stream, new OoxmlSaveOptions(SaveFormat.Xlsx));
workbook.Save(@"c:\tempfolder\testing3.xlsx", new OoxmlSaveOptions(SaveFormat.Xlsx)); 

Let us know if you still find the issue?

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.

@AndyC2C,

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.