int lastColIndex = pivotArea.getLastCell().getCol() - pivotArea.getFirstCell().getCol();
if(columnIndex > lastColIndex) {
throw new IndexOutOfBoundsException();
}
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;
if(pivotTableDefinition.getRowFields() != null) {
rowFields = pivotTableDefinition.getRowFields();
} else {