需要包:poi-3.5.jar、poi-ooxml-3.5.jar
实例:
- public class ProcessExcel {
- private Workbook wb = null;
- private Sheet s = null;
- private Row row = null;
- public ProcessExcel(String filePath) {
- try {
- System.out.println(filePath);
- if (filePath.endsWith("xls")) {
- wb = new HSSFWorkbook(new FileInputStream(new File(filePath)));
- } else {
- wb = new XSSFWorkbook(filePath);
- }
- System.out.println(wb);
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- /**
- * 表格表2-27-1 院(系)教学效果——本科生学科竞赛获奖情况 (TBL_DEPART_SUBJECT_HONOR)
- *
- * @param isInsert
- */
- public ExcelModel importExcel3281() {
- ExcelModel em = new ExcelModel();
- List<TblDepartSubjectHonor> list = new ArrayList<TblDepartSubjectHonor>();