[JExcel] Erreur "java.lang.ArrayIndexOutOfBoundsException"
Bonjour,
Je travaille sur un projet et je suis amené à faire des manipulations avec des fichiers Excel.
J'ai réalisé un test mais j'ai une exception et je ne sais pas comment y remédier.
J'ai créé un fichier myfile que j'ai rempli des différentes cases.
Voilà un bout de code que j'ai écrit :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| import java.io.File;
import java.io.IOException;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import jxl.read.biff.BiffException;
public class projet {
/**
* @param args
* @throws IOException
* @throws BiffException
*/
public static void main(String[] args) throws IOException, BiffException {
Formulaire f= new Formulaire("/Users/oussamarbati/Desktop/Hanche33.jpg");
Workbook workbook = Workbook.getWorkbook(new File("/Users/oussamarbati/Desktop/myfile.xls"));
Sheet sheet = workbook.getSheet(0);
Cell a1 = sheet.getCell(0,0); //C'est ici que je reçoi
Cell b2 = sheet.getCell(1,1);
Cell c2 = sheet.getCell(2,1);
String stringa1 = a1.getContents();
String stringb2 = b2.getContents();
String stringc2 = c2.getContents();
System.out.println(stringa1);
System.out.println(stringb2);
System.out.println(stringc2);
}
} |
Et voilà l'Exception :
Citation:
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
at jxl.read.biff.SheetImpl.getCell(SheetImpl.java:356)
at projet.main(projet.java:41)
Quelqu'un saurait-il m'expliquer d'où peut venir le problème ?
Merci d'avance pour votre aide.