public static void write(OutputStream os){
QdService as;
AbstractApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
as=(QdService)ctx.getBean("qdongService");
try{
//创建一个可写入的excel文件对象
WritableWorkbook workbook = Workbook.createWorkbook(os);
//使用第一张工作表,将其命名为“午餐记录”
WritableSheet sheet = workbook.createSheet("薄型气缸", 0);
//表头
Label label0 = new Label(0, 0, "缸径");
sheet.addCell(label0);
Label label1 = new Label(1, 0, "行程");
sheet.addCell(label1);
Label label2 = new Label(2, 0, "A");
sheet.addCell(label2);
Label label3 = new Label(3, 0, "B");
sheet.addCell(label3);
sheet.addCell(new Label(4,0,"C"));
sheet.addCell(new Label(5,0,"D"));
sheet.addCell(new Label(6,0,"E"));
sheet.addCell(new Label(7,0,"F"));
sheet.addCell(new Label(8,0,"G"));
sheet.addCell(new Label(9,0,"X"));
sheet.addCell(new Label(10,0,"Y"));
sheet.addCell(new Label(11,0,"Z"));
sheet.addCell(new Label(12,0,"图像1"));
sheet.addCell(new Label(13,0,"图像2"));
sheet.addCell(new Label(14,0,"价格"));
sheet.addCell(new Label(15,0,"数量1"));
sheet.addCell(new Label(16,0,"折扣1"));
sheet.addCell(new Label(17,0,"数量2"));
sheet.addCell(new Label(18,0,"折扣2"));
sheet.addCell(new Label(19,0,"数量3"));
sheet.addCell(new Label(20,0,"折扣3"));
sheet.addCell(new Label(21,0,"采购价"));
sheet.addCell(new Label(22,0,"供应商1"));
sheet.addCell(new Label(23,0,"供应商2"));
List list=as.AllQdong();
System.out.println(list.size());
int c;
for(int i=0;i<list.size();i++){
Qdong qdong=(Qdong) list.get(i);
sheet.addCell(new Label(0,qdong.getId(),qdong.getBore()));
sheet.addCell(new Label(1,qdong.getId(),qdong.getRoute()));
sheet.addCell(new Label(2,qdong.getId(),qdong.getA()));
sheet.addCell(new Label(3,qdong.getId(),qdong.getB()));
sheet.addCell(new Label(4,qdong.getId(),qdong.getC()));
sheet.addCell(new Label(5,qdong.getId(),qdong.getD()));
sheet.addCell(new Label(6,qdong.getId(),qdong.getE()));
sheet.addCell(new Label(7,qdong.getId(),qdong.getF()));
sheet.addCell(new Label(8,qdong.getId(),qdong.getG()));
sheet.addCell(new Label(9,qdong.getId(),qdong.getE()));
sheet.addCell(new Label(10,qdong.getId(),qdong.getF()));
sheet.addCell(new Label(11,qdong.getId(),qdong.getG()));
sheet.addCell(new Label(12,qdong.getId(),qdong.getImage1()));
sheet.addCell(new Label(13,qdong.getId(),qdong.getImage2()));
sheet.addCell(new Label(14,qdong.getId(),qdong.getPrice()));
sheet.addCell(new Label(15,qdong.getId(),String.valueOf(qdong.getNum())));
sheet.addCell(new Label(16,qdong.getId(),qdong.getDiscount()));
sheet.addCell(new Label(17,qdong.getId(),String.valueOf(qdong.getNum1())));
sheet.addCell(new Label(18,qdong.getId(),qdong.getDiscount1()));
sheet.addCell(new Label(19,qdong.getId(),String.valueOf(qdong.getNum2())));
sheet.addCell(new Label(20,qdong.getId(),qdong.getDiscount2()));
sheet.addCell(new Label(21,qdong.getId(),qdong.getPrice1()));
sheet.addCell(new Label(22,qdong.getId(),qdong.getSupplier1()));
sheet.addCell(new Label(23,qdong.getId(),qdong.getSupplier2()));
}
// ExcelDate_Log excel_Log=new ExcelDate_Log();
/* excel_Log.setOperateTime(DataUtil.format(new Date()));
excel_Log.setImportdata(0);
excel_Log.setStatus(1);*/
workbook.write();
workbook.close();
}catch(Exception e){
System.out.println(e);
}
}