Jexcel

Java Excel API Projects

Java Excel API Project 1

How To Create sheets for the workbook?
Previous Home Next

 

In this we are going to create writable sheets for the workbook. To create sheets we have create a new instance of WritableSheet.
In next topic we will discus how we can create labels? 

The WritableWorkbook class is an abstract class which extends java.lang.Object is a writable workbook which provides factory methods and various fields.  

To create sheets for the workbook WritableWorkbook has a factory method. Which takes the name of the sheet and the index position of sheet in the workbook.
 The createSheet(java.lang.String name, int index):-
This method is used to create an instance of WritableSheet for workbook. This is static method of WritableWorkbook class and have return type WritableSheet.


In this we have to pass two arguments first is name of the sheet and second is sheet positions. e.g. In following syntax we are going to create a sheet with name “R4R Excel Sheet” at zero position. The new sheet is created at the beginning of the workbook with name “R4R Excel Sheet” as output.
Syntax:

WritableSheet sheet = workbook.createSheet("R4R Excel Sheet", 0);

 

Previous Home Next