Java poi 3.16 XSSF透视表-为列设置筛选器

Java poi 3.16 XSSF透视表-为列设置筛选器,java,filter,apache-poi,pivot-table,xssf,Java,Filter,Apache Poi,Pivot Table,Xssf,我想生成一个透视表,所有列都应该有如图所示的过滤器 除了最后一个列外,是否还有其他列在poi中激活它,因为它只是一个和列 Ma生成透视表的当前代码: int firstRow = sheet.getFirstRowNum() + firstDataRow; int lastRow = sheet.getLastRowNum(); int firstCol = sheet.getRow(0).getFirstCellNum(); int lastCol = sheet.getRow(firstRo

我想生成一个透视表,所有列都应该有如图所示的过滤器

除了最后一个列外,是否还有其他列在poi中激活它,因为它只是一个和列

Ma生成透视表的当前代码:

int firstRow = sheet.getFirstRowNum() + firstDataRow;
int lastRow = sheet.getLastRowNum();
int firstCol = sheet.getRow(0).getFirstCellNum();
int lastCol = sheet.getRow(firstRow).getLastCellNum();

CellReference topLeft = new CellReference(firstRow, firstCol);
CellReference botRight = new CellReference(lastRow, lastCol - 1);

AreaReference areaRef = new AreaReference(topLeft, botRight);

XSSFPivotTable pivotTable = pivotSheet.createPivotTable(areaRef,
        new CellReference(firstRow, firstCol), sheet);

pivotTable.addRowLabel(lastCol - 1); // Month
pivotTable.addRowLabel(6); // User
pivotTable.addRowLabel(lastCol - 2); // State
pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 0,
        resBundle.getString("WG_NM")); // count

CTPivotFields pFields = 
pivotTable.getCTPivotTableDefinition().getPivotFields();
pFields.getPivotFieldArray(lastCol - 1).setOutline(false);
pFields.getPivotFieldArray(6).setOutline(false);
pFields.getPivotFieldArray(lastCol - 2).setOutline(false);

最好的方法是使用模板->最好的方法是使用模板->