excel导出
Posted ZZL
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了excel导出相关的知识,希望对你有一定的参考价值。
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导出的主要内容,如果未能解决你的问题,请参考以下文章