POI自动过滤 [英] POI Auto Filter

查看:698
本文介绍了POI自动过滤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何使用Apache POI至$ P $一个Excel 2007文档中对定义自动过滤区域?

How do I use Apache POI to pre-define an auto-filter region in an Excel 2007 document?

一个小code例子或链接就好了。

A small code example or link would be nice.

推荐答案

保存第一和过滤面积的最后一个单元格,然后执行:

Save the first and the last cell from the filter area, and execute:

sheet.setAutoFilter(new CellRangeAddress(firstCell.getRow(), lastCell.getRow(), firstCell.getCol(), lastCell.getCol()));

例如,从下面的片

>x         (x, y)
  0123456  
0|--hhh--|   h = header
1|--+++--|   + = values
2|--+++--|   - = empty fields
3|--+++--|
4|-------|

拳头电池将首先 + (2,1)单元格上方的标题。在最后的将是最后 + 细胞(5,3)

fist cell will be the header above the first + (2,1) cell. The the last will be the last + cell (5,3)

这篇关于POI自动过滤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆