Free Support Forum - aspose.com

Disable AutoFilter while formatting a list object (table)

Hi,


How to disable “AutoFilter” while formatting a list object (table).
I am applying one of the predefined styles in TableStyleType.

Hi,

Thanks for your posting and using Aspose.Cells.

Please set the ListObject.AutoFilter.Range to null, then it will disable the autofilter on your table.

Please see the following sample code. I have attached the source excel file used in this code and the output excel file generated by it for your reference.

C#


string filePath = @“D:\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


ListObject lobj = worksheet.ListObjects[0];


lobj.AutoFilter.Range = null;


workbook.Save(“output.xlsx”);

It works!


Thank you.

Hi,


Good to know that your issue is sorted out now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.