Write a simple spreadsheet data without any formatting information.
Previous | Home | Next |
Write a simple spreadsheet data without any formatting information.
To create a simple spread sheet we have to create a workbook first, then we have to create a sheet in that workbook then we can write any simple element in it. For this, we have to use the following classes,
jxl.write.WritableWorkbook for creating a workbook
jxl.write.WritableSheet for creating a sheet
jxl.write.Lable for creating a Label
Firstly we have to create a workbook as,
WritableWorkbook workbook=Workbook.createWorkbook(File file);
WritableSheet ws=workbook.createSheet("mysheet", 0);
Then we create a simple label as,
Label lblName=new Label(0,0, "Name");
and finally add this label to the sheet by using the addCell method as,
ws.addCell(lblName);
and finally use the write() and close() methods on the workbook,
workbook.write();
workbook.close();
Previous | Home | Next |