Métodos para la creación de xls
#Devuelve la fila lógica (no física) 0-based. getRow(int rownum)
#Union de celdas o merge
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("new sheet");
Row row = sheet.createRow((short) 1);
Cell cell = row.createCell((short) 1);
cell.setCellValue("This is a test of merging");
sheet.addMergedRegion(new CellRangeAddress(
1, //first row (0-based)
1, //last row (0-based)
1, //first column (0-based)
2 //last column (0-based)
));
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
#Obtener el valor de las columnas ejemplo "AC" Sumatoria de columnas
for(int colum = 43; colum< 50; colum++){
String nextLetter = String.valueOf(CellReference.convertNumToColString(colum ));
cell = sumRow.createCell(colum);
cell.setCellFormula("SUM(" + nextLetter + mapRowReporte.get("rowMembresia")+ ":" + nextLetter + totalMemb + ")")
//stylo
cell.setCellStyle(styles.get("sumatoria"));
}
#Datos para el metodo setCellFormula
cell.setCellFormula("SUM(" + "AC" + "4:" + "AC" + 8 + ")")