J'ai besoin de lire un fichier Excel. J'ai écrit ce code mais il y a une erreur.
Voici mon code:
Quelles sont les causes de l'erreur?
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
34
35
36
37
38
39
40
41
42 package javaapplication7; import java.io.File; import java.io.IOException; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; import jxl.write.*; import jxl.write.Number; import java.awt.*; import javax.swing.*; /** * * @author AGORA */ public class JavaApplication7 { /** * @param args the command line arguments */ public static void main(String[] args) throws Exception { File f=new File("C:\\Users\\AGORA\\Desktop\\baAse2G.xls"); Workbook wb=Workbook.getWorkbook(f); Sheet s=wb.getSheet(0); int row =s.getRows(); int col =s.getColumns(); for (int i = 0; i<=row;i++){ for (int j = 0; j<=col;j++){ Cell c=s.getCell(i, j); System.out.print(c.getContents()+"\t\t"); } System.out.print(""); } } }
Merci d'avance
Partager