Good that such They know what is the method to put the text of a cell in black to apply the style from java with the class poi Thanks and a greeting.
HSSFWorkbook a = archivoexcel();
HSSFSheet hoja = a.createSheet("LOGS");
int longitud = datos.size();
Iterator ithora = hora.iterator();
Iterator itnom= nom.iterator();
Iterator itmin = min.iterator();
Iterator itentorn = entorno.iterator();
Iterator it = datos.iterator();
while (it.hasNext()) {
for (int i = 0; i < longitud; i++) {
HSSFRow filacabe = hoja.createRow(0);
HSSFCell celdaca = filacabe.createCell((short) 0);
HSSFCell celda2ca = filacabe.createCell((short) 1);
HSSFCell celda4ca = filacabe.createCell((short) 2);
HSSFCell celda5ca = filacabe.createCell((short) 3);
HSSFCell celda6ca = filacabe.createCell((short) 4);
HSSFCell celda7ca = filacabe.createCell((short) 4);
celdaca.setCellValue("Nombre test");
celda2ca.setCellValue("MENSAJE");
celda4ca.setCellValue("Entorno");
celda5ca.setCellValue("Hora");
celda6ca.setCellValue("FECHA");
celda7ca.setCellValue("Nombre");
HSSFRow fila = hoja.createRow(i + 1);
HSSFCell celda = fila.createCell((short) 0);
HSSFCell celda2 = fila.createCell((short) 1);
HSSFCell celda4 = fila.createCell((short) 2);
HSSFCell celda5 = fila.createCell((short) 3);
HSSFCell celda6 = fila.createCell((short) 4);
HSSFCell celda7 = fila.createCell((short) 4);
String info = it.next().toString();
String[] infoslip = info.split(";");
celda.setCellValue(infoslip[0]);
if (infoslip[1].equalsIgnoreCase("")) {
celda2.setCellValue(infoslip[1]);
celda4.setCellValue(itentorn.next().toString());
celda5.setCellValue(ithora.next().toString()+": "+itmin.next().toString());
celda6.setCellValue(fecha);
celda7.setCellValue(itnom.next().toString());
} else {
celda2.setCellValue(infoslip[1]);
celda4.setCellValue(itentorn.next().toString());
celda5.setCellValue(ithora.next().toString()+": "+itmin.next().toString());
celda6.setCellValue(fecha);
celda7.setCellValue(itnom.next().toString());
}
}
}
this.archivo(a);
this is my code and I wanted to put the format in the headers