简单实例代码,实际使用中应该加上异常处理机制:
12345678910111213 FileInputStream is = new FileInputStream(file);
ExcelReader excelReader = new ExcelReader();
String[] title = excelReader.readExcelTitle(is);//读取文件标题(非文件名,而是文件第一行)
for (String str : title) {
System.out.println(str);
}
is.close();
is = new FileInputStream(file);
Map<Integer, String> map = excelReader.readExcelContent(is);//读取文件内容
for (int i = 1; i <= map.size(); i++) {
System.out.println(map.get(i));
}
is.close();
相关截图: