|
@@ -90,58 +90,4 @@ public class OaPriceInExcelDaoImpl implements OaPriceInExcelDao {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 导出Excel
|
|
|
- */
|
|
|
- public void exportExcel() {
|
|
|
- WritableWorkbook book = null;
|
|
|
- try {
|
|
|
- // 打开文件
|
|
|
- book = Workbook.createWorkbook(new File("D:/test/测试.xls"));
|
|
|
- // 生成名为"学生"的工作表,参数0表示这是第一页
|
|
|
- WritableSheet sheet = book.createSheet("测试", 0);
|
|
|
- // 指定单元格位置是第一列第一行(0, 0)以及单元格内容
|
|
|
- Label label1 = new Label(0, 0, "ID");
|
|
|
- Label label2 = new Label(1, 0, "价格id");
|
|
|
- Label label3 = new Label(2, 0, "出发城市三字码代码");
|
|
|
- Label label4 = new Label(3, 0, "ret_cicy");
|
|
|
- Label label5 = new Label(4, 0, "出发日期");
|
|
|
- Label label6 = new Label(5, 0, "adult_tax");
|
|
|
- Label label7 = new Label(6, 0, "积分");
|
|
|
- Label label8 = new Label(7, 0, "dep_airport");
|
|
|
- Label label9 = new Label(8, 0, "arr_airport");
|
|
|
- Label label10 = new Label(9, 0, "arr_time");
|
|
|
- Label label11 = new Label(10, 0, "dep_time");
|
|
|
- Label label12 = new Label(11, 0, "航班号");
|
|
|
- // 将定义好的单元格添加到工作表中
|
|
|
- sheet.addCell(label1);
|
|
|
- sheet.addCell(label2);
|
|
|
- sheet.addCell(label3);
|
|
|
- sheet.addCell(label4);
|
|
|
- sheet.addCell(label5);
|
|
|
- sheet.addCell(label6);
|
|
|
- sheet.addCell(label7);
|
|
|
- sheet.addCell(label8);
|
|
|
- sheet.addCell(label9);
|
|
|
- sheet.addCell(label10);
|
|
|
- sheet.addCell(label11);
|
|
|
- sheet.addCell(label12);
|
|
|
- // 保存数字的单元格必须使用Number的完整包路径
|
|
|
- jxl.write.Number number = new jxl.write.Number(1, 0, 30);
|
|
|
- sheet.addCell(number);
|
|
|
- // 写入数据并关闭文件
|
|
|
- book.write();
|
|
|
- } catch (Exception e) {
|
|
|
- System.out.println(e);
|
|
|
- }finally{
|
|
|
- if(book!=null){
|
|
|
- try {
|
|
|
- book.close();
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
}
|