Filter partiell columns

Posted by: sascha.hennig on 11 September 2018, 1:16 am EST

    • Post Options:
    • Link

    Posted 11 September 2018, 1:16 am EST

    Hi.

    I would like to filter not a linked range of columns, but something like this: Filter von column A to C, no filter on D to F and a filter on G. How could i achiev this?

    With the code below, i only could set an autofilter to a connected range of cells.

    worksheet.RowFilter = new HideRowFilter(new CellRange(-1, 2, -1, 1));
    

    Best regards,

    Sascha

  • Posted 11 September 2018, 8:25 pm EST

    Hello Sacha,

    You would need to apply filters on different cell ranges in this case.

    For example:

    worksheet.RowFilter = new HideRowFilter(new CellRange(-1, 2, -1, 1));

    worksheet.RowFilter = new HideRowFilter(new CellRange(-1, 4, -1, 1));

    Thanks,

    Deepak Sharma

  • Posted 12 September 2018, 12:07 am EST - Updated 29 September 2022, 6:10 am EST

    Hello.

    Sorry, that doesn’t work. The result is, that only the last filter is shown (see screenshot).

  • Posted 12 September 2018, 11:22 pm EST

    Hello,

    It looks your only option is to hide the filter icon for columns where you do not want the user to filter. You can customize the header with VisualTreeHelper class to remove the filter icon.

    Thanks,

    Deepak Sharma

Need extra support?

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

Learn More

Forum Channels