Apache Poi - Cellstyle. Align_Right

Apache Poi - Cellstyle. Align_Right

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:

1

2 Answers

Maybe you're looking for

cellStyle.setAlignment(HorizontalAlignment.RIGHT);
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);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.