In this program we are going to set alignment of cells
on an excel sheet.
The packages we need to import are java.io.*,java.util.* ,org.apache.poi.hssf.usermodel.HSSFSheet,org.apache.poi. hssf. usermodel. HSSFCellStyle, org.apache.poi.usermodel.HSSFRow, org.apache.poi.usermodel.HSSFCell ,and org.apache.poi.hssf.usermodel. HSSFWorkbook.
This method is used to set the alignment of cell. We first create cell style and then set the alignment to the cell. In this example we are creating cell with center alignment. But you can use other alignments.
The code of the program is given below:
The output of the program is given below:
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Discuss: Working With Alignment Using JSP for Excel
Post your Comment