为什么数据透视表中第一列的名称未自动设置,但设置了以下列的名称。
我生成像这样的数据透视表:
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);
第一列的名称应为月份。
有没有办法手动设置?