2011-11-03 48 views

Respuesta

-4
style = wb.createCellStyle(); 
style.setFillForegroundColor(IndexedColors.ORANGE.getIndex()); 
style.setFillPattern(CellStyle.SOLID_FOREGROUND); 
cell = row.createCell((short) 2); 
cell.setCellValue("X"); 
cell.setCellStyle(style); 
+3

no contiene nada sobre la alineación en absoluto? se trata de color de fondo ... – efirat

18

tenido este problema, así, se le sorprendidos, pero permite establecer alineamiento vertical al estilo de los puntos de interés que debe utilizar setVerticalAlignment() función no setAlignment(). Ejemplo:

XSSFCellStyle styleSubHeader = (XSSFCellStyle) wb.createCellStyle(); 
styleSubHeader.setVerticalAlignment(CellStyle.VERTICAL_CENTER); 
4
XSSFWorkbook wbOut = new XSSFWorkbook();  
CellStyle style = wbOut.createCellStyle(); 
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP); 
cell.setCellStyle(style); 
3

Puede utilizar este código:

style.setVerticalAlignment(VerticalAlignment.TOP); 
Cuestiones relacionadas