0

Recently, I've met a problem on how to set the text into the vertical top using XSSF, I need to put the text in the top of one cell, but when I use

cellStyle.setVerticalAlignment(CellStyle.VERTICAL_TOP);

it always show the text in the middle center of the cell, i'm so confused and don't know which method i need to change, very appreciate someone could give me some hints, thanks so much in advance!

yuan
  • 1
  • 2
  • 2
    And you're setting this `CellStyle` on the `Cell` in question, correct? – David Conrad Nov 05 '17 at 04:14
  • 2
    Current version of `apache poi`does not using `CellStyle.VERTICAL_TOP` but [VerticalAlignment.TOP](https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/VerticalAlignment.html#TOP), see also [CellStyle.setVerticalAlignment](https://poi.apache.org/apidocs/org/apache/poi/ss/usermodel/CellStyle.html#setVerticalAlignment-org.apache.poi.ss.usermodel.VerticalAlignment-). So what `apache poi` version are you using and why not the current one? And where are you getting the wrong result? In `Microsoft Excel`? Or in `Calc` of `Libreoffice` or `OpenOffice`? – Axel Richter Nov 05 '17 at 06:52
  • Thank you all for the response, now the question is solved. I used VerticalAlignment.TOP – yuan Nov 05 '17 at 14:39

0 Answers0