JAVA JXL方式解析excel,简单代码片段,jxlexcel,package com.
分享于 点击 26919 次 点评:230
JAVA JXL方式解析excel,简单代码片段,jxlexcel,package com.
package com.using.test;import java.io.File;import jxl.Cell;import jxl.Sheet;import jxl.Workbook;import jxl.WorkbookSettings;public class TestExcel { public static void main(String[] args) { Workbook book; try { File file = new File("F:\\\\temp\\\\111.xls"); WorkbookSettings workbookSettings = new WorkbookSettings(); workbookSettings.setEncoding("UTF-8"); book = Workbook.getWorkbook(file, workbookSettings); Sheet sheet = book.getSheet(0); for (int i = 1; i < sheet.getRows(); i++) { for (int j = 0; j < sheet.getColumns(); j++) { Cell cell = sheet.getCell(j, i); String result = cell.getContents(); System.out.println(result); } } book.close(); System.out.println(); } catch (Exception e) { e.printStackTrace(); } }}//该片段来自于http://byrx.net
用户点评