en *_*pes 2 java excel xls apache-poi maven
我想对齐文字.这是我的pom.xml:
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.17</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
在我的代码中:
import org.apache.poi.ss.usermodel.CellStyle;
Run Code Online (Sandbox Code Playgroud)
但是当我想使用它(CellStyle.ALIGN_RIGHT)时,我得到了这个编译错误:
小智 9
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);
Run Code Online (Sandbox Code Playgroud)
小智 6
也许你在寻找
cellStyle.setAlignment(HorizontalAlignment.RIGHT);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5301 次 |
| 最近记录: |