码迷,mamicode.com
首页 > 其他好文 > 详细

excel导出

时间:2019-05-27 19:25:58      阅读:111      评论:0      收藏:0      [点我收藏+]

标签:level   system   eal   public   desktop   ted   xls   void   pack   

package webber.gshdsb.util;

import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;

public class ExcelImport {

public static String dealData(String filepath) {

File xlsFile = new File(filepath);
Workbook workbook;

try {
workbook = Workbook.getWorkbook(xlsFile);
Sheet sheet = workbook.getSheet(0);


for (int i = 0; i < sheet.getRows(); i++) {
Cell[] row = sheet.getRow(i);

for (int j = 0; j < row.length; j++) {

String enrolevel = row[j].getContents().trim();
System.out.print(enrolevel);
}

}
workbook.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (BiffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "";

}

public static void main(String[] args) {
dealData("C:/Users/Administrator/Desktop/资料/燕京学堂/燕京学堂功能模块计划.xls");
}

}

excel导出

标签:level   system   eal   public   desktop   ted   xls   void   pack   

原文地址:https://www.cnblogs.com/zzl0916/p/10932279.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!