文件名称:java处理execl表格源码
文件大小:716KB
文件格式:RAR
更新时间:2012-09-03 03:17:30
java处理execl表格源码
本作品为一个公司出路考勤表的程序 JFileChooser chooser1 = new JFileChooser(); int state = chooser1.showOpenDialog(null); chooser1.show(); String filepath=null; boolean flag = true; if (chooser1.getSelectedFile() != null && state == JFileChooser.APPROVE_OPTION) { filepath = chooser1.getSelectedFile().getAbsolutePath(); WritableWorkbook info = null; WritableSheet sheet = null; Label c = null; try { File f = new File(filepath+".xls"); f.exists(); info = Workbook.createWorkbook(f); sheet = info.createSheet("ok", 0); int size = l.size(); for (int i = 0; i < size; i++) { String[] msg = l.get(i).toString().split(","); c = new Label(0, i, msg[0]); sheet.addCell(c); c = new Label(1, i, msg[1]); sheet.addCell(c); c = new Label(2, i, msg[2]); sheet.addCell(c); c = new Label(3, i, msg[4]); sheet.addCell(c); c = new Label(4, i, msg[5]); sheet.addCell(c); System.out.println(i+1); if(i+2>size) { break; } String[] msg1 = l.get(i+1).toString().split(","); c = new Label(5, i++,msg1[5]); sheet.addCell(c); } info.write(); } catch (Exception ex) { flag = false; ex.printStackTrace(); } finally { try { if (info != null) { info.close(); } } catch (Exception exx) { }
【文件预览】:
salery
----.project(382B)
----bin()
--------com()
----src()
--------com()
----.classpath(428B)
----lib()
--------AbsoluteLayout.jar(3KB)
--------swing-layout-1.0.3.jar(115KB)
--------jxl.jar(726KB)