I am using POI api. Now my problem is that I am not able to align cell text vertically top.I am using getCellStyle().setAlignment(HSSFCellStyle.VERTICAL_TOP)
to set alignment .
Yet when I open sheet it is not impacted.
Had this problem as well, you will be supprised but to set vertical aligment to style in POI you should use setVerticalAlignment()
function not setAlignment()
. Example:
XSSFCellStyle styleSubHeader = (XSSFCellStyle) wb.createCellStyle();
styleSubHeader.setVerticalAlignment(CellStyle.VERTICAL_CENTER);