Bonjour,
Dans le cadre dans mon projet, je dois générer les résultats obtenus dans un fichier Excel, j'ai lu sur internet que POI Apache et une bonne API pour faire cela.
J'ai donc importé l'api dans mon build path :
- poi-5.0.0
- poi-examples-5.0.0
- poi-excelant-5.0.0
- poi-integration-5.0.0
- poi-ooxml-5.0.0
- poi-ooxml-full-5.0.0
- poi-ooxml-lite-5.0.0
- poi-scratchpad-5.0.0
- commons-compress-1.20
- curvesapi-1.06
- xmlbeans-4.0.0
- commons-codec-1.15
- commons-collections4-4.4
- commons-math3-3.6.1
- SparseBitSet-1.2
Y-a t-il des jar qui servent à rien ?
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 import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; 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; public class Excel { public static void main( String[] args) { HSSFWorkbook wb = new HSSFWorkbook(); HSSFSheet sheet = wb.createSheet("ma feuille"); HSSFRow row = sheet.createRow(0); HSSFCell cell = row.createCell((short)0); cell.setCellValue(10); row.createCell((short)1).setCellValue(20); FileOutputStream fileOut; try { fileOut = new FileOutputStream("monfichier.xls"); wb.write(fileOut); fileOut.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }Je ne comprend pas l'erreur...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7 Exception in thread "main" java.lang.Error: Unresolved compilation problems: The type org.apache.poi.xssf.usermodel.XSSFSheet cannot be resolved. It is indirectly referenced from required .class files Type mismatch: cannot convert from XSSFSheet to Sheet The type java.time.LocalDateTime cannot be resolved. It is indirectly referenced from required .class files The type java.time.LocalDate cannot be resolved. It is indirectly referenced from required .class files at Excel.main(Excel.java:15)
Merci d'avance
Partager