lire un fichier excel à l'aide d'Apache POI

J'ai créé ce code permet de lire le contenu de fichiers excel à l'aide d'Apache POI. J'utilise eclipse comme éditeur, mais quand j'ai couru le code j'ai un problème dans la ligne que j'ai en gras. Quel est le problème?
Le contenu de excel est la suivante:

Emp ID  Name    Salary

 1.0    john    2000000.0

 2.0    dean    4200000.0

 3.0    sam     2800000.0

 4.0    cass    600000.0

import java.io.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
public class ExcelRead {
public static void main(String[] args) throws Exception {
File excel = new File ("C:\\Users\\Efi\\Documents\\test.xls");
FileInputStream fis = new FileInputStream(excel);
HSSFWorkbook wb = new HSSFWorkbook(fis);
HSSFSheet ws = wb.getSheet("Input");
int rowNum = ws.getLastRowNum()+1;
int colNum = ws.getRow(0).getLastCellNum();
String[][] data = new String[rowNum][colNum];
for (int i=0; i<rowNum; i++){
HSSFRow row = ws.getRow(i);
for (int j=0; j<colNum; j++){
HSSFCell cell = row.getCell(j);
String value = cellToString(cell);
data[i][j] = value;
System.out.println("The value is" + value);
}
}
}
public static String cellToString (HSSFCell cell){
int type;
Object result;
type = cell.getCellType();
switch(type) {
case 0://numeric value in excel
result = cell.getNumericCellValue();
break;
case 1: //string value in excel
result = cell.getStringCellValue();
break;
case 2: //boolean value in excel
result = cell.getBooleanCellValue ();
break;
default:
***throw new RunTimeException("There are not support for this type of               
cell");***
}
return result.toString();
}
}
le problème tis ici: throw new RunTimeException("Il n'y a pas de support pour ce type de cellule");
où est la ligne u en gras?le "throw new Exception..."?,la fonction cellToString doit attraper l'exception de vous jeter ou ajoute un "throws Exception" pour lui-même.

OriginalL'auteur user2235454 | 2013-04-02