Free Support Forum - aspose.com

Slider on different table generate corrupted file

hi,
if we have two sheet (or more) with two table (or more) and we create a slider on each table the file is corrupted.

Code:
var license = new License();
license.SetLicense(“Aspose.Total.lic”);
var file = Path.Combine(TestContext.CurrentContext.TestDirectory, “Ressources”, $"{nameof(BugSlicer)}.xlsx");
if (File.Exists(file))
{
File.Delete(file);
}

        using(var workbook = new Workbook())
        {
            workbook.FileFormat = FileFormatType.Xlsx;
            workbook.Worksheets.Clear();
            PrepareSheet(workbook, "Data 1");
            PrepareSheet(workbook, "Data 2");


            workbook.Save(file);
        }
        Assert.Pass("Validation done by manual file inspection");

with
private static void PrepareSheet(Workbook workbook,string sheetName, bool twoSlider = false)
{

        var iIndex = workbook.Worksheets.Add(SheetType.Worksheet);
        var sheet = workbook.Worksheets[iIndex];
        sheet.Name = sheetName;
        workbook.Worksheets.ActiveSheetIndex = sheet.Index;
        sheet.ActiveCell = "A1";

        sheet.Cells["A1"].PutValue("Col1");
        sheet.Cells["B1"].PutValue("Col2");
        sheet.Cells["C1"].PutValue("Col3");
        sheet.Cells["D1"].PutValue("Col4");
        sheet.Cells["E1"].PutValue("Col5");
        sheet.Cells["F1"].PutValue("Col6");

        for (var i = 2; i < 102; i++)
        {
            sheet.Cells["A" + i].PutValue(i);
            sheet.Cells["B" + i].PutValue(DateTime.Today.AddDays(-i));
            sheet.Cells["C" + i].PutValue("Test" + (i % 4));
            sheet.Cells["D" + i].PutValue(DateTime.Today.AddDays(i % 8));
            sheet.Cells["E" + i].PutValue("Another Test" + (i % 5));
            sheet.Cells["F" + i].PutValue(i * 3.14);
        }

        var dateStyle = workbook.CreateStyle();
        dateStyle.Custom = "dd-MM-yyyy";
        var flag = new StyleFlag()
        {
            All = true
        };
        sheet.Cells.ApplyColumnStyle(1, dateStyle, flag);
        sheet.Cells.ApplyColumnStyle(3, dateStyle, flag);

        sheet.AutoFitColumns();
        
        // Create Table
        var selectedTable = sheet.ListObjects[sheet.ListObjects.Add(0, 0, sheet.Cells.MaxDataRow, sheet.Cells.MaxDataColumn, true)];
        var listColumn = selectedTable.ListColumns[2];
        sheet.Slicers.Add(selectedTable, listColumn, 5, 7);
        if (twoSlider)
        {
            sheet.Slicers.Add(selectedTable, selectedTable.ListColumns[3], 5, 10);
        }
    }

@Chabie,

Please notice, we were able to reproduce the issue as you mentioned. If we have two or more sheets with two or more tables and we create a slicer on each table, the file will be corrupted. We have logged a ticket with an id “CELLSNET-47635” for your issue. We will look into it soon.

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

@Chabie,

This is to inform you that we have fixed your issue now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@Chabie.

Please try our latest version/fix: Aspose.Cells for .NET v20.9.13 (attached)

Your issue should be fixed in it.

Let us know your feedback.
Aspose.Cells20.9.13 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.9.13 For .Net4.0.Zip (5.4 MB)

I use .net standard, Could I have a compatible version

@Chabie,

Please try our latest .NET Standard version/fix (attached).
Aspose.Cells20.9.14 For .NetStandard20.Zip (5.4 MB)

Let us know your feedback.

Hi,
Yes bug fixed, waiting for Nuget package now

thanks

@Chabie,

Thanks for your confirmation on the fix.

We are scheduled to publish our next official release (Aspose.Cells for .NET v20.10) on Downloads section and Nuget repos. within the next 7-10 days, so you may get the version from Nuget repos.

The issues you have found earlier (filed as CELLSNET-47635) have been fixed in Aspose.Cells for .NET v20.10. This message was posted using Bugs notification tool by Amjad_Sahi. You may also get the version @ Nuget repos. (https://www.nuget.org/packages/Aspose.Cells/20.10.0).