package com.yanek.test;
import java.io.File;
import java.io.IOException;
import jxl.Workbook;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
public class ExcelWrite {
/**
* @param args
*/
public static void main(String[] args) {
WritableWorkbook workbook = null;
try {
workbook = Workbook.createWorkbook(new File("c://test123.xls"));
WritableSheet ws=workbook.createSheet("test123",1);
Label label1=new Label(0,0,"aaa");
Label label2=new Label(1,0,"bbb");
Label label3=new Label(2,0,"ccc");
Label label4=new Label(0,1,"ddd");
Label label5=new Label(1,1,"eee");
Label label6=new Label(2,1,"fff");
try {
ws.addCell(label1);
ws.addCell(label2);
ws.addCell(label3);
ws.addCell(label4);
ws.addCell(label5);
ws.addCell(label6);
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
workbook.write();
try {
workbook.close();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}