我想在Excel文件中的列上添加自动过滤器,但是WritableWorkbook不提供自动过滤器方法,例如
HSSFWorkbook my_workbook = new HSSFWorkbook();
HSSFSheet my_sheet = my_workbook.createSheet("Autofilter");
my_sheet.setAutoFilter(CellRangeAddress.valueOf("A1:I"+Rowcount);
那么如何在使用WritableWorkbook生成的Excel文件中的列上添加自动过滤器?
我的Excel文件正在使用以下代码生成:
WritableWorkbook w = null;
/* Create WorkBook */
w = Workbook.createWorkbook(response.getOutputStream());
/* Create Sheet */
WritableSheet sheet = w.createSheet(filename, 0);
/* Add Columns */
Label results = new Label(0, 0, "first", cf);
sheet.setColumnView(0, 40);
sheet.addCell(results);
Label DateTime = new Label(1, 0, "second", cf);
sheet.setColumnView(1, 30);
sheet.addCell(DateTime);
Label rcptIdLabel = new Label(2, 0, "Third", cf);
sheet.setColumnView(2, 20);
sheet.addCell(rcptIdLabel);
int rowNo=0;
/* Add Data in Columns */
for (Iterator<Incident> iterator = arrylist.iterator(); iterator.hasNext();) {
ListObj listdata = (ListObj) iterator.next();
Label dateTime = new Label(0, rowNo, listdata.getfirstname());
sheet.addCell(dateTime);
Label employeeId = new Label(1, rowNo, listdata.getmidname());
sheet.addCell(employeeId);
Label name = new Label(3=2, rowNo, listdata.getlastname());
sheet.addCell(name);
rowNo++;
}
w.write();
w.close();
请帮助我添加针对Excel文件的自动过滤功能。