In this program we are going to create a sheet after
that set the values into it's cell and set the height and width.
The package we need to import is java.io.*,java.util.* ,org.apache.poi.hssf.usermodel.HSSFSheet, org.apache.poi.hssf.usermodel. HSSFPrintSetup, org.apache.poi.hssf.usermodel.HSSFRow, org.apache.poi.hssf.usermodel.HSSFCell org.apache. poi.hssf.usermodel. HSSFSimpleShape and org.apache.poi.hssf.usermodel. HSSFWorkbook.
The method used in this example:
This method is used to fit the height of the sheet.The return type is void.
setFitWidth(short width) :
This method is used to fit the width of the sheet .The return type o f this method is also void.
In this example we are creating a sheet then we create the new font and add the font into workbook's object after that we create an object of print setup then set cells values and finally set the fit height and width.
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