2011-11-03 20 views

Odpowiedz

-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

nie zawiera niczego o wyrównanie w ogóle? chodzi o kolor tła ... – efirat

18

miał ten problem jak dobrze, będzie supprised ale ustawienie pionowe Aligment do stylu w UM trzeba zastosować setVerticalAlignment() funkcja nie setAlignment(). Przykład:

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

Można użyć tego kodu:

style.setVerticalAlignment(VerticalAlignment.TOP); 
Powiązane problemy