Not able to apply a filter

Posted by: maya.halter on 26 January 2023, 12:26 am EST

    • Post Options:
    • Link

    Posted 26 January 2023, 12:26 am EST - Updated 26 January 2023, 12:31 am EST

    Hi all,

    We are using GrapeCity.Documents.Excel 4.2.6 in a .Net 7.0 library project.

    We tried to add a filter to one of our documents but it seems like the way you describe it in the docs does not work for us.

    I just tried it with your given code in the docs: https://www.grapecity.com/documents-api-excel/demos/createfilterwithoutcondition

    //create a new workbook
    var workbook = new GrapeCity.Documents.Excel.Workbook();
    
    IWorksheet worksheet = workbook.Worksheets[0];
    
    object[,] data = new object[,]{
        {"Name", "City", "Birthday", "Eye color", "Weight", "Height"},
        {"Richard", "New York", new DateTime(1968, 6, 8), "Blue", 67, 165},
        {"Nia", "New York", new DateTime(1972, 7, 3), "Brown", 62, 134},
        {"Jared", "New York", new DateTime(1964, 3, 2), "Hazel", 72, 180},
        {"Natalie", "Washington", new DateTime(1972, 8, 8), "Blue", 66, 163},
        {"Damon", "Washington", new DateTime(1986, 2, 2), "Hazel", 76, 176},
        {"Angela", "Washington", new DateTime(1993, 2, 15), "Brown", 68, 145}
    };
    
    worksheet.Range["A1:F7"].Value = data;
    worksheet.Range["A:F"].ColumnWidth = 15;
    
    //Create filters whithout condition.
    worksheet.Range["A1:F7"].AutoFilter();
            
    // Save to an excel file
    workbook.Save("CreateFilterWithoutCondition.xlsx");

    if i run the code snippet on your website it looks correct:

    If i run this code locally it looks like this:

    Do you know why that might be?

    Kind regards

    Maya

  • Posted 26 January 2023, 6:44 pm EST

    Hello Maya,

    This issue is not related to .NET 7. Actually, this functionality is added to the GcExcel API in the 5.0.3 release as mentioned in the following release notes:

    https://www.nuget.org/packages/GrapeCity.Documents.Excel/5.0.3#release-body-tab

    We do not see any license linked to your account, but if you have a valid license to use the 5.0.3 version API then you can upgrade to this version to use this functionality.

    Regards,

    Prabhat Sharma.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels