this is my table and i want display like this
i m giving my code below
AreaReference a=new org.apache.poi.hssf.util.AreaReference("A1:G1673");
CellReference b=new CellReference("I5");
XSSFPivotTable pivotTable = my_sheet.createPivotTable(a,b);
pivotTable.addRowLabel(2);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 2, "Animated");
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 3, "Static");
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 5);
FileOutputStream out=new FileOutputStream("/home/yuktamedia/Downloads/HP/banner1.xlsm");
wb.write(out);
out.close();
but my output comes like this i don't know how to add column data fields
pivotTable.addRowLabel(2);
pivotTable.addColumnLabel(DataConsolidateFunction.SUM, 5);
pivotTable.addDataColumn(5, true);
pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).setAxis(
org.openxmlformats.schemas.spreadsheetml.x2006.main.STAxis.AXIS_COL);
pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).addNewItems();
pivotTable.getCTPivotTableDefinition().getPivotFields().getPivotFieldArray(1).getItems().addNewItem().setT(
org.openxmlformats.schemas.spreadsheetml.x2006.main.STItemType.DEFAULT);
pivotTable.getCTPivotTableDefinition().addNewColFields().addNewField().setX(1);
sorted problem by this
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments