We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Calling "IWorkbook.SaveAsAsync" multiple times results in files that are bigger and bigger. [XlsIO for WinRT]

Thread ID:

Created:

Updated:

Platform:

Replies:

110534 Aug 9,2013 02:11 PM UTC Aug 14,2013 01:07 PM UTC WPF 2
loading
Tags: XlsIO
Giovanni Albani
Asked On August 9, 2013 02:11 PM UTC

Dear Syncfusion support,

It seems that, if a worksheet contains at least one chart, calling the method "IWorkbook.SaveAsAsync" multiple times results in files that are bigger and bigger. This appears to happen when saving in the Excel2013 XLSX format using XlsIO for WinRT (both v11.2.0.25 and v11.2.0.65).

STEPS TO REPRODUCE:

//Please run the following code for the WinRT platform:

async Task Test()
{
    // Create a new workbook:
    var excelEngine = new ExcelEngine();
    var workbook = excelEngine.Excel.Workbooks.Create();
    workbook.Version = ExcelVersion.Excel2013; // Note: This line is important to reproduce the issue.
    var worksheet = workbook.Worksheets[0];

    // Add some data:
    for (int rowIndex = 1; rowIndex < 5; rowIndex++)
        worksheet.Range[rowIndex, 1].Value2 = rowIndex;

    // Add a chart:
    var chart = worksheet.Charts.Add();
    chart.DataRange = worksheet.Range["A1:A4"];

    // Save the workbook 10 times to a user-selected folder:
    var folderPicker = new FolderPicker();
    folderPicker.FileTypeFilter.Add(".xlsx");
    var destinationFolder = await folderPicker.PickSingleFolderAsync();
    if (destinationFolder != null)
    {
        for (int n = 1; n <= 10; n++)
        {
            var storageFile = await destinationFolder.CreateFileAsync(string.Format("Test {0}.xlsx", n), CreationCollisionOption.ReplaceExisting);
            await workbook.SaveAsAsync(storageFile);
        }
    }
}


EXPECTED RESULT : The 10 files should be identical and have the same size.

ACTUAL RESULT : The size of the first file is 7KB, the size of the second file is 8KB, etc. The size of the files keep increasing. The size of the last file is 14KB.


This is very annoying because I need to create many XLSX files where each file is slightly different from the previous one, but I end up with files that are bigger and bigger. In case of large files, the delta can be significant. I thought of a workaround that consists in cloning the workbook each time before saving it, but the "IWorkbook.Clone()" method does not seem to work (cf. other forum thread in the same forum category).

Is there any workaround for saving a workbook (with charts) to XLSX multiple times without causing its size to keep increasing?

Thank you in advance for your help.

Best regards,
Giovanni

Sridhar [Syncfusion]
Replied On August 14, 2013 12:59 PM UTC

Hi Giovanni,
 
Thank for for using Syncfusion products.
 

We are able to reproduce the above reported exception at our end. Please open a new direct-trac incident with a simple issue reproducing excel file  for further follow up on this issue.

 

Direct Trac Link:
 
Please let me know if you have any further clarifications.
 
Thanks,
Sridhar.S

Sridhar [Syncfusion]
Replied On August 14, 2013 01:07 PM UTC

Hi Giovanni,

Please ignore the previous post.

We are able to reproduce the above reported file size increasing issue at our end. Please open a new direct-trac incident with a simplified sample which reproduces the file size increasing issue for further follow up on this.
 
Direct Trac Link:

http://www.syncfusion.com/support/directtrac/


Please let me know if you have any further clarifications.
 

Thanks,

Sridhar.S


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;