java读取excel文件的代码

如下内容段是关于java读取excel文件的内容,应该能对各朋友有所用途。

package com.zsmj.utilit;

import java.io.FileInputStream;
import java.io.IOException;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class ParseExcel {

private void parseExcel(String excelFile)throws IOException {

HSSFRow row=null;
String data=null;
row =sheet.getRow(i);
case HSSFCell.CELL_TYPE_BLANK:
data="";
break;
case HSSFCell.CELL_TYPE_NUMERIC:
data=(long)row.getCell((short)j).getNumericCellValue()+"";
break;
default:
data=row.getCell((short)j).getStringCellValue();
break;
}
System.out.print(data+"t");
}
System.out.println();
}
}
public static void main(String[] args)throws IOException {
new ParseExcel().parseExcel(args[0]);
}

}






原文地址:https://www.cnblogs.com/javahouse/p/10064240.html