private boolean importAll(File file){
try{
InputStream input = null;
try {
input = new FileInputStream(excel);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if(input == null){
return false;
}
HSSFWorkbook wb = null;
try {
wb = new HSSFWorkbook(input);
} catch (IOException e) {
e
try{
InputStream input = null;
try {
input = new FileInputStream(excel);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if(input == null){
return false;
}
HSSFWorkbook wb = null;
try {
wb = new HSSFWorkbook(input);
} catch (IOException e) {
e

该代码段展示了一个使用Apache POI库读取名为'全部专家信息'工作表中数据的过程。从第二行开始,逐行读取每个单元格的值,将这些值分别赋给Expert实体类的属性,如姓名、职位、工作单位等,并通过expertDao.add(e)保存到数据库中。如果在读取或保存过程中遇到FileNotFoundException或IOException等异常,会进行相应处理。
最低0.47元/天 解锁文章
7436

被折叠的 条评论
为什么被折叠?



