Xlsb file corrupted when saved first time from aspose workbook


#1

//getting xcel corrupted with pivot table when saving a workbook as xslb first time “workbook.Save(fileName)”;
// When we save as xlsx, reload the file, save 2nd time as xlsb and open xlsb works fine
var xlFile = fileName.Replace(XLSB, XLSX);
//save as xlsx which opens fine
workbook.Save(xlFile);
AsposeCells.LoadOptions loadOptions = new AsposeCells.LoadOptions(AsposeCells.LoadFormat.Xlsx) { MemorySetting = AsposeCells.MemorySetting.MemoryPreference };

// load saved xlsx to aspose workbook
using (var xlsx = new AsposeCells.Workbook(inputPathAndFile, loadOptions))
{
// save xlsb. When opened this file is not corrupted
xlsx.Save(outputPathAndFile, AsposeCells.SaveFormat.Xlsb);
}


#2

@LakshmiAys,

Thanks for your query.

Please share your sample file and code snippet(runnable console application) with us for our testing. We will reproduce the problem and provide our feedback after analysis.


#3

I am attaching the corrupted and non corrupted files.FirstXlsbSaveCorrupt.zip (634.8 KB)


#4

@LakshmiAys,

I tried it simply by loading XLSX file and saving it back as XLSB, however no issue is observed when this output XLSB file is opened in Excel 2016. This scenario is tested using latest version Aspose.Cells for .NET 18.11.x and following sample code:

Workbook wb = new Workbook("FirstSaveXlsxWorks.xlsx");
wb.Save("FirstSaveXlsb.xlsb");

Please try this scenario using latest version and provide your feedback. If still issue is there please send us the console application (runnable) along with the XLSX file for our testing.