Add the Cells into the Worksheet.

Add the Cells into the Worksheet.

Previous Home Next

 

Now we will learn how to add the Cells into the Worksheet.

For adding cells to a WritableSheet, first of all we have to create  a WritableSheet simply by importing the 
public interface WritableSheet which is contained in the jxl.write.WritableSheet.
 For adding a cell to a WritableSheet, firstly we create a WritableSheet as,
WritableSheet ws=workbook.createSheet("mysheet",0);

Then create any cell, say, a label we have created as,
Label lblName=new Label(0,0, "Name");

Then add this label cell by calling the addCell(WritableCell) method on the WritableSheet object as,
ws.addCell(lblName);
This adds a cell named Name to the sheet.


 

Previous Home Next