java 阿帕奇兴趣点。在 Excel 中设置数据过滤器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3737668/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Apache POI. Setup data filters in Excel
提问by Fazal
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.
我已经使用 Apache POI 有一段时间了,它运行良好,但我无法在库中找到有关过滤器支持的可靠答案。
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.
作为参考,我指的是 Excel 数据选项卡中可用的过滤器选项,它允许您将列的所有唯一值显示为列标题中的组合框。
I know there is already a question about it generate excel in javawhere this question was asked.
我知道已经有一个关于它在 Java中生成 excel的问题,其中提出了这个问题。
And I see that Apache POI people checked in something recently for this https://issues.apache.org/bugzilla/show_bug.cgi?id=35125
我看到 Apache POI 的人最近为此检查了一些东西 https://issues.apache.org/bugzilla/show_bug.cgi?id=35125
Is there anyone who has used POI new version to try filter option?
有没有人用过 POI 新版本来尝试过滤选项?
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
由于等待具有此功能的最终版本的 POI 对我们来说可能是不可能的,任何人都可以指出其他允许此选项的 Excel Java API(据我所知,JExcel 没有)。我确实看到许多网站允许通过过滤功能导出到 excel。如果没有好的 API 来提供它,是否有任何其他方式或在 excel 上进行后期处理,我可以添加此选项
Sorry for the repeated question, but I could not see any other way to resolve my issue other than approaching stackoverflow community
很抱歉重复的问题,但除了接近 stackoverflow 社区之外,我看不到任何其他方法来解决我的问题
回答by Carlos Rubio
It's already enabled in Apache POI 3.7. How? take a look...
它已在 Apache POI 3.7 中启用。如何?看一看...
sheet.setAutoFilter(CellRangeAddress.valueOf("A1:C200"));
sheet.setAutoFilter(CellRangeAddress.valueOf("A1:C200"));