Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache POI. Setup data filters in Excel

I have been using Apache POI for quite sometime and it works great but I am not able to find a reliable answer about filter support in the library.

For reference, I mean the filter option available in data tab in excel which allows you to show all unique values of a column as a combo box in the header of the Column.

I know there is already a question about it generate excel in java where this question was asked.

And I see that Apache POI people checked in something recently for this https://issues.apache.org/bugzilla/show_bug.cgi?id=35125

Is there anyone who has used POI new version to try filter option?

As waiting for the final release of POI with this feature may not be possible for us, can anyone point out other Excel Java API which allow this option (JExcel does not as far as I found out). I do see many websites allowing export to excel with filtering available. If there is no good API to provide it, is there any other way or post processing on excel which i can do to add this option

Sorry for the repeated question, but I could not see any other way to resolve my issue other than approaching stackoverflow community

like image 564
Fazal Avatar asked Sep 17 '10 17:09

Fazal


People also ask

How do I create a custom filter in Excel?

Click a cell in the range or table that you want to filter. On the Data tab, click Filter. in the column that contains the content that you want to filter. Under Filter, click Choose One, and then enter your filter criteria.


1 Answers

It's already enabled in Apache POI 3.7. How? take a look...

sheet.setAutoFilter(CellRangeAddress.valueOf("A1:C200"));

like image 66
Carlos Rubio Avatar answered Sep 18 '22 12:09

Carlos Rubio