Setting a ListColumn's Autofilter VisibleDropDown property

Is it possible to set the VisibleDropDown property of a ListColumn in aspose.cells?



Hi,

Which version you are using .NET or Java? What is the namespace/package for the class/property you mentioned?

Using .NET (ASPOSE.Cells runtime v2.0.50727)



When creating a table based on a range (ListObject), each cell of the table header will have an autofilter dropdown button added to the cell automatically.



Sometimes, its helpful to make some or all of those autofilter dropdowns invisible to protect the table from being sorted/filtered by specific columns (in the case of my project, its a requirement).



Using Excel VBA, you can elect to hide any or all of the autofilter dropdowns using:



Range([TableRangeAddress]).AutoFilter Field:=Range([ColumnAddress]).column, Visibledropdown:=False



Wanted to check to see if it was possible to access this property via ASPOSE.CELLS .NET 2.0.



Let me know if there is add’l info I can provide to further clarify.



Thanks!

Quick poke to see if you had any further guidance.

Thanks!

Hi,

You need to set ListObject.AutoFilter.Range=null to hide the filter. Please see the code below and input file and output file generated by this code.

C#


string file=@“F:\Downloads\source.xlsx”;


Workbook wb = new Workbook(file);

Worksheet ws = wb.Worksheets[0];


ws.ListObjects[0].AutoFilter.Range = null;


wb.Save(file + “.out.xlsx”);

Hi – thanks for researching this.



Your solution works for the entire table which is promising, but I’d like to be able to manipulate the dropdown visibility on a per-column basis (as described in the sample above). Experimenting a bit – it looks like ListColumns does not have an AutoFilter property as is the case for ListObjects which would’ve been the most convenient.



Any other potential solutions?



Thank you!

Hi,

Thanks. Please attach two Excel files which you can create manually. One with your desired input and the other with your desired output. I will look into it.

Thank you!



asposeTableTest_Orig.xlsm - default table behavior



asposeTableTest_Mod.xlsm - one column header has dropdown visibility set to false… You see that column “2” has no drop down.



This is accomplished using the following:



Range(“A3:D10”).AutoFilter Field:=Range(“B3”).column, Visibledropdown:=False



Let me know if there is anything else I can provide.

Hi,

It seems like this feature is not available. Can you please tell me, how did you set the dropdown invisible for second column? Did you manually do it or did you set it programmatically? Let me know, how did you achieve it in both ways.

I have added a New Feature Request for it with id: CELLSNET-24600.

Hi,

We have added this feature in our upcoming release, so now you will able to hide the dropdown lists using the following code. We will provide you a link to download it as soon as possible.


book.Worksheets[0].AutoFilter.FilterColumnCollection[0].Visibledropdown = false;

Thank you so much for considering this as a new feature. Very helpful!

Can you give me a rough idea of when a new version might be available? Just need to know if we’re talking days, weeks or months so I can plan accordingly.

Thank you!

Hi,

It has been released. Follow this link.

Thank you so much!