时间:2021-07-01 10:21:17 帮助过:39人阅读
Workbook wb = Workbook.getWorkbook(new File(E:\\lt.xls)); SimpleDateFormat df = new SimpleDateFormat(yyyyMMdd); Sheet sheet = wb.getSheet(0);// Cell cell = sheet.getCell(2,4); int hang = sheet.getRows(); int lie = sheet.getColumns(); ListH
Workbook wb = Workbook.getWorkbook(new File("E:\\lt.xls")); SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd"); Sheet sheet = wb.getSheet(0); // Cell cell = sheet.getCell(2,4); int hang = sheet.getRows(); int lie = sheet.getColumns(); List
list = new ArrayList (); for(int x=1;x<500;x++){ String id = UUID.randomUUID().toString(); Huadan huadan = new Huadan(); huadan.setHdid(id); huadan.setThqsrq(df.parse(sheet.getCell(1, x).getContents())); System.out.println(df.parse(sheet.getCell(1, x).getContents())); huadan.setThqssj(sheet.getCell(2, x).getContents()); System.out.println(sheet.getCell(2, x).getContents()); huadan.setThsc(Integer.parseInt(sheet.getCell(3, x).getContents())); System.out.println(Integer.parseInt(sheet.getCell(3, x).getContents())); huadan.setHjlx(sheet.getCell(4, x).getContents()); System.out.println(sheet.getCell(4, x).getContents()); huadan.setMylx(sheet.getCell(5, x).getContents()); System.out.println(sheet.getCell(5, x).getContents()); huadan.setDfdqh(sheet.getCell(6, x).getContents()); System.out.println(sheet.getCell(6, x).getContents()); huadan.setDfhmq(sheet.getCell(7, x).getContents()); System.out.println(sheet.getCell(7, x).getContents()); huadan.setBjh(sheet.getCell(8, x).getContents()); System.out.println(sheet.getCell(8, x).getContents()); huadan.setThlx(sheet.getCell(9, x).getContents()); System.out.println(sheet.getCell(9, x).getContents()+"dddddddd"); huadan.setYsjbthf(Double.parseDouble(sheet.getCell(10, x).getContents())); System.out.println(Double.parseDouble(sheet.getCell(10, x).getContents())); huadan.setYhhjbthf(Double.parseDouble(sheet.getCell(11, x).getContents())); System.out.println(Double.parseDouble(sheet.getCell(11, x).getContents())); huadan.setYsctthf(Double.parseDouble(sheet.getCell(12, x).getContents())); System.out.println(Double.parseDouble(sheet.getCell(12, x).getContents())); huadan.setYhhctthf(Double.parseDouble(sheet.getCell(13, x).getContents())); System.out.println(Double.parseDouble(sheet.getCell(13, x).getContents())); huadan.setYsqtf(Double.parseDouble(sheet.getCell(14, x).getContents())); System.out.println(Double.parseDouble(sheet.getCell(14, x).getContents())); huadan.setYhh(Double.parseDouble(sheet.getCell(15, x).getContents())); System.out.println(Double.parseDouble(sheet.getCell(15, x).getContents())); huadan.setJzh(sheet.getCell(16, x).getContents()); System.out.println(sheet.getCell(16, x).getContents()); huadan.setXqh(sheet.getCell(17, x).getContents()); System.out.println(sheet.getCell(17, x).getContents()); huadan.setImei(sheet.getCell(18, x).getContents()); System.out.println(sheet.getCell(18, x).getContents()); System.out.println("----------------------------------------"); list.add(huadan); } //System.out.println(hang+" "+lie); wb.close(); for(int x=0;x