ListObject AutoFilter Removal, Show/Hide flag

I was looking for a way to control a ListObject Table Style, specifically hiding the Filter Button. There is no flag to set, unlike for the other options, such as table header, total row, etc.
image.png (3.4 KB)

However, setting the AutoFilter to null had worked as a workaround.

ListObject listObject = targetSheet.ListObjects[targetSheet.ListObjects.Add(firstTableRow,     firstTableColumn, tableRows, tableColumns, true)];
listObject.AutoFilter.Range = null;

Issue 1: Setting AutoFilter to null was working to get rid of the Filter dropdowns on headers in version 20.9.0. However, upgrading to version 21.1.0 broke this - the filter was not removed in the final file.

Issue 2: Exposing a ListObject flag for FilterButton would be ideal. This would be consistent with the other flags that control other flags in the Excel screenshot above.

Eg.
listObject.ShowHeaderRow = true;

Thanks.

@ptan,

Thanks for the details.

Yes, we found listObject.AutoFilter.Range = null does not work to remove the filters. You may try the following line instead, it will work for the purpose:
listObject.ConvertToRange();

Hope, this helps a bit.

Hi Amjad,
Thanks for that. I am aware of the ConvertToRange() workaround, though it is not ideal as it removes the List Object entirely.

Would you raise this as an issue to be fixed, as well as an enhancement to add the ability to set the Show Filter flag? Hope you can let us know that the bugfix would be worked on soon as well.

Thanks.

@ptan.

I have logged a ticket with an id “CELLSNET-47848” for your issue. Either we will fix the issue or provide relevant API for your task. We will look into it soon.

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

@ptan,

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.

Great news! Thanks Amjad.

@ptan
Please try the latest fix 21.1.4 with the following codes:
Workbook workbook = new Workbook(“CellsNet47848.xlsx");
ListObject table = workbook.Worksheets[0].ListObjects[0];

        table.AutoFilter.ShowFilterButton = false;

Aspose.Cells21.1.4 For .Net2_AuthenticodeSigned.Zip (5.5 MB)
Aspose.Cells21.1.4 For .Net4.0.Zip (5.5 MB)
Aspose.Cells21.1.4 For .NetStandard20.Zip (5.5 MB)

The issues you have found earlier (filed as CELLSNET-47848) have been fixed in this update. This message was posted using Bugs notification tool by simon.zhao

Thanks @simon.zhao. Issue has been resolved. Appreciate the quick and complete resolution!

@ptan,

Thanks for your feedback and good to know that your issue is resolved by the latest version/fix.