Wokbook saved in .xlsx format has very big file size

Product: Aspose.Cells .NET
Version: 17.9.0.0
Problem: Wokbook saved in .xlsx format has very big file size.

The problem is default value of the OoxmlSaveOptions.ExportCellName property.
In the previous version of Aspose.Cells this value is FALSE. In 17.9.0.0 OoxmlSaveOptions.ExportCellName is TRUE after constructor.
But API Reference at

says : Default value is false.

Repro code:
var wb = new Workbook(FileFormatType.Xlsx);
var ws = wb.Worksheets[0];

for (var i = 0; i < 10000; i++)
{
    for (var j = 0; j < 100; j++)
    {
        ws.Cells[i, j].Value = "Test";
    }
}

wb.Save(@"C:\TEMP\2\1.xlsx");       // Bad: File size: 2.6M, like ExportCellName = TRUE
wb.Save(@"C:\TEMP\2\2.xlsx", SaveFormat.Xlsx); // Bad: File size: 2.6M, like ExportCellName = TRUE
wb.Save(@"C:\TEMP\2\3.xlsx", new OoxmlSaveOptions(SaveFormat.Xlsx)); // Bad: File size: 2.6M, like ExportCellName = TRUE
wb.Save(@"C:\TEMP\2\4.xlsx", new OoxmlSaveOptions(SaveFormat.Xlsx) {ExportCellName = false}); // Good: File size: 220K, like ExportCellName = FALSE

var so = new OoxmlSaveOptions();
Assert.IsFalse(so.ExportCellName);      // Assertion Failed, ExportCellName is TRUE!

@evgeny,

Thanks for the sample code and details.

After an initial test, I am able to observe the issue as you mentioned by using your sample code. I found that the default value of the OoxmlSaveOptions.ExportCellName property is true instead of false. Due to this issue, the output file’s size is bigger. I have logged a ticket with an id “CELLSNET-45769” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

@evgeny,

We found that the default value of the attribute in MS Excel is true. So we rightly changed the default value as true too, But we actually forgot to update API description in the documentation. We will update the documentation soon. This is not an issue with the Aspose.Cells APIs.

Hi, Amjad Sahi

We use save methods without creation SaveOptions in many places of our code:

    *  workbook.Save("book.xlsx");
    *  workbook.Save(stream, saveFormat);

After upgrade to current version of Aspose.Cells, resulting files size increased dramatically.
We need some static API, that allows us to manage the default value of OoxmlSaveOptions.ExportCellName property.

Regards, Evgeny

@evgeny,

We recommend you to replace your line of code in those places as following, it will work for your needs:
workbook.Save(stream, new OoxmlSaveOptions(SaveFormat.Xlsx) {ExportCellName = false});

I am not sure if it is feasible and we could provide you a separate static API to change the default value for ExportCellName attribute. Anyways, I have logged your comments against your issue into our database.

If we have any new information, we will update you here.

The issues you have found earlier (filed as CELLSNET-45769) have been fixed in this Aspose.Cells for .NET 17.12 update.

Please also check the following article: