}
CTPivotFields pivotFields = pivotTableDefinition.getPivotFields();
List<CTPivotField> pivotFieldList = pivotTableDefinition.getPivotFields().getPivotFieldList();
CTPivotField pivotField = CTPivotField.Factory.newInstance();
CTItems items = pivotField.addNewItems();
pivotField.setAxis(STAxis.AXIS_ROW);
pivotField.setShowAll(false);
for(int i = 0; i <= lastRowIndex; i++) {
items.addNewItem().setT(STItemType.DEFAULT);
}
items.setCount(items.getItemList().size());
pivotFieldList.set(columnIndex, pivotField);
pivotFields.setPivotFieldArray(pivotFieldList.toArray(new CTPivotField[pivotFieldList.size()]));
CTRowFields rowFields;