//Genera la tabla dinamica
public XSSFWorkbook generatabladinamica(XSSFWorkbook workbook, Sheet sheet, int size, InputStream file, String name) {
/////////////////////////////////tabla dinamica en hoja dos
int firstRow = 2;//sheet.getFirstRowNum();
int lastRow = sheet.getLastRowNum();
int firstCol = 1;//sheet.getRow(2).getFirstCellNum();
int lastCol = sheet.getRow(2).getLastCellNum();
//---------------------------------------------------------\\
CellReference topleft = new CellReference(firstRow, firstCol);
CellReference botRigth = new CellReference(lastRow, lastCol - 1);
//---------------------------------------------------------\\
XSSFSheet hoja2 = workbook.createSheet("TABLA");
setcolor(workbook, hoja2, size);//AGREGAR EL PRIMER COLOR
setimagen(workbook, hoja2, name, file);//AGREGA LA IMAGEN
CellReference createpivot = new CellReference("C6");
AreaReference source = new AreaReference(topleft, botRigth);
//---------------------------------------------------------\\
XSSFPivotTable pivotTable = hoja2.createPivotTable(source, createpivot, sheet);
pivotTable.addReportFilter(0);
pivotTable.addRowLabel(6);
pivotTable.addRowLabel(7);
//pivotTable.addRowLabel(9);
pivotTable.addColumnLabel(DataConsolidateFunction.COUNT, 3, "Total");
return workbook;
}