Reputation: 2133
I am trying to align text. Here my pom.xml:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
in my code:
import org.apache.poi.ss.usermodel.CellStyle;
but when I want to use it (CellStyle.ALIGN_RIGHT
) , I got this compilation error:
Upvotes: 6
Views: 16294
Reputation: 91
XSSFFont font = workBook.createFont();
Old : font.setBoldweight(XSSFFont.BOLDWEIGHT_BOLD);
New : font.setBold(true);
also
CellStyle style = workBook.createCellStyle();
OLD : style.setAlignment(CellStyle.ALIGN_CENTER);
New : style.setAlignment(HorizontalAlignment.CENTER);
then
style.setFont(font);
Upvotes: 9
Reputation:
Maybe you're looking for
cellStyle.setAlignment(HorizontalAlignment.RIGHT);
Upvotes: 18