1
我想使用apache poi從excel中讀取數據並將該數據存儲到2Dimentional String Array中。使用下面的代碼我會顯示數據,但我想存儲數據。如何使用apache poi從excel讀取數據並將數據存儲到String [] []數組中?
public static void main(String[] args) throws Exception {
File f = new File("C:/Users/SYKAMREDDY/Desktop/testData.xls");
FileInputStream fis = new FileInputStream(f);
HSSFWorkbook wb = new HSSFWorkbook(fis);
HSSFSheet sh = wb.getSheet("Data");
int rc=sh.getLastRowNum()-sh.getFirstRowNum();
for (int i = 1; i < rc; i++) {
Row r = sh.getRow(i);
for (int j = 1; j < r.getLastCellNum(); j++) {
String s = r.getCell(j).getStringCellValue();
System.out.print(s+" ");
}
System.out.println();
}
}
什麼我你面臨的問題是什麼?正在讀取的數據是否成功如果是,您希望達到什麼目的? –