public static void main(String[] args) {
ExcelTest3 test3=new ExcelTest3();
String path="E:/1.xls";
test3.creatExcel(path);
}
public void creatExcel(String path)
{
String[] str={"编号","转速","时间","经度","纬度","GPS车速","海拔","GPS方向","GPS里程","判断速度","车速(m/s)","加速度","判断加速度"};
WritableWorkbook wwb = null;
try {
wwb=Workbook.createWorkbook(new File(path));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if(wwb!=null) {
WritableSheet ws=wwb.createSheet("data",0);
for(int i=0;i<str.length;i++)
{
Label lableC=new Label(0,i,str[i]);
try {
ws.addCell(lableC);
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
wwb.write();
wwb.close();
} catch (IOException | WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
}