We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Auto Filter Contains


I am trying to filter my excel sheet, it have custom filter but how to use “contains”

worksheet.AutoFilter.Custom(1, FilterOperatorType.Contains, “Total”);


We have noticed FilterOperatorType.Contains property to be missing in latest version of the API. We have logged the issue in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issue has been logged as

CELLSNET-46319 - FilterOperatorType.Contains property not available


Well, you may try to use CustomFilter with regex, see the sample line of code:
Sample code:

worksheet.AutoFilter.Custom(1, FilterOperatorType.Equal, “*Total*”);

which will filter those string values that contains “Total”.

Hope, this helps a bit.


We have fixed your issue, so you don’t have to use the suggested code segment anymore. We have added relevant FilterOperatorType enum member.

Once the fix is available for public use, we will share the Download link.


Please try our latest version/fix: Aspose.Cells for .NET v18.8.4:

Your issue should be fixed in it.

Let us know your feedback.

Its there Amjad but not working. I am using worksheet.AutoFilter.Custom(0, FilterOperatorType.Contains, “BASE:”);

Actually now older one also not working. The filter is applied but I need to do it manually.


I have tested your scenario/ case using a simple template file (attached) and following sample code, it works fine and the output file (attached) is fine tuned. The “Contains” text filter is working as expected:
Sample code:

Workbook workbook = new Workbook("e:\\test2\\Bk_autofiltercontains1.xlsx");
            Worksheet worksheet = workbook.Worksheets[0];
            worksheet.AutoFilter.Range = "A1:B8";
            worksheet.AutoFilter.Custom(1, FilterOperatorType.Contains, "BASE:");


Also, see the screenshot taken in MS Excel when checking the custom auto-filters:

If you still find the issue with v18.8.4, kindly do provide us your template file and paste sample code (runnable) to reproduce the issue, we will check it soon.
files1.zip (12.8 KB)

The issues you have found earlier (filed as CELLSNET-46319) have been fixed in Aspose.Cells for .NET v18.9. This message was posted using BugNotificationTool from Downloads module by Amjad_Sahi

We also recommend you to kindly try our latest version/fix: Aspose.Cells for .NET v18.10 in which we included more enhancements and fixes.