I've been looking for a way to generate an excel from java with the correct format for a couple of days. I have to make a table with their column names and above the name of the columns should put a title. The problem is that if a title is added in the first column, the format I have of the columns in the tables is lost. I want to use a format only for that column of the title and that does not affect the table that I have just below. This I put below if I do not put the table just below it comes out correctly taking several cells but putting it with the table introduces all the data that I have put of the title in a cell what causes that the table does not remain correctly. On the other hand I also want to appear with the format that appears in the first column of the table but only get me to do the format for the entire column until the end and I do not know how to adjust it to the cells used by the table.
// Esto seria mi titulo
HSSFRow row = sheet.createRow((short)0);
row.setHeight((short) 600);
HSSFCell cell = (HSSFCell) row.createCell((short) 1);
cell.setCellValue("Este es el titulo de la tabla");
//esto seria el nombre de cada columna
HSSFRow headerRow = sheet.createRow(rowIndex++);
List<String> headerValues = ReportExcel
.getTableHeaderPedidos();
HSSFCell headerCell = null;
for (int i = 0; i < headerValues.size(); i++) {
headerCell = headerRow.createCell(i);
headerCell.setCellStyle(style);
headerCell.setCellValue(headerValues.get(i));
}