excel导出

mac2022-06-30  98

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"); }

}

转载于:https://www.cnblogs.com/zzl0916/p/10932279.html

最新回复(0)