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:
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: May 19, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles