Apache POI – CellStyle.ALIGN_RIGHT

我正在尝试alignment文本。 在这里我的pom.xml:

<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi-ooxml</artifactId> <version>3.17</version> </dependency> 

在我的代码中:

 import org.apache.poi.ss.usermodel.CellStyle; 

但是当我想使用它( CellStyle.ALIGN_RIGHT ),我得到这个编译错误:

在这里输入图像说明

也许你正在寻找

 cellStyle.setAlignment(HorizontalAlignment.RIGHT);