为何Excel高版本会报NoClassDef?各种包也都引入了?

来源:2-5 Excel实战之XSSF创建高版本Excel

weibo_俄勒冈的微波炉_0

2017-05-18 00:17

http://img.mukewang.com/591c76ed0001a07707490151.jpg

http://img.mukewang.com/591c76ee0001170603750370.jpg

String[] title = {"id", "name", "gender"};

第21行: XSSFWorkbook workbook = new XSSFWorkbook();

Sheet sheet = workbook.createSheet();

Row row = sheet.createRow(0);

Cell cell = null;

for (int i=0; i< title.length; i++){

cell = row.createCell(i);

cell.setCellValue(title[i]);

}

//Insert 10 records 

for (int i=1; i<10; i++){

Row nextrow = sheet.createRow(i);

cell=nextrow.createCell(0);

cell.setCellValue("a"+ i);

cell=nextrow.createCell(1);

cell.setCellValue("AI#" + i);

cell=nextrow.createCell(2);

cell.setCellValue("Male");

}

//Write the records into xls file

File file = new File("C:/eclipse/test_new.xlsx");

try {

file.createNewFile();

FileOutputStream stream = FileUtils.openOutputStream(file);

workbook.write(stream);

stream.close();

workbook.close();

System.out.println("Export Sucessfully!");

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}


写回答 关注

1回答

  • 慕祈
    2017-05-21 10:12:45

    就是有jar包没有找到,找找看是不是有遗漏了


解密JAVA实现Excel导入导出

Java web开发过程当中常见场景,轻松实现文件导入导出

66109 学习 · 132 问题

查看课程

相似问题