Bonjour,
Voilà je recherche le moyen d'ouvrir un fichier excel à partir d'une application Java. J'aimerais utiliser si possible une autre API libre car Ezjcom avec Jexcel n'existe qu'en période d'évaluation.
Merci des réponces.
Bonjour,
Voilà je recherche le moyen d'ouvrir un fichier excel à partir d'une application Java. J'aimerais utiliser si possible une autre API libre car Ezjcom avec Jexcel n'existe qu'en période d'évaluation.
Merci des réponces.
http://www.developpez.net/forums/sho...rir+excel+java
le petit problème c'est que cela m'affiche une erreur :
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 package ExcelSamplePoi; import java.io.*; public class ExcelOuvrirFichier { public static void main(String[] args) { try{ //Lancer excel en indiquant l'URL Runtime run = Runtime.getRuntime(); String cmd = "excel c:\\cablageFT.xls"; Runtime.getRuntime().exec(cmd); }finally{} } }
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 Exception in thread "Main Thread" java.lang.Error: Unresolved compilation problems: Unhandled exception type JComException Unhandled exception type JComException Unhandled exception type JComException Unhandled exception type JComException Unhandled exception type JComException Unhandled exception type JComException Unhandled exception type JComException Unhandled exception type JComException at ExcelSamplePoi.ouvrirapplicationexcel.main(ouvrirapplicationexcel.java:11)
vérifie si le chemin qui mene au fichier executable est bien ce que je vois là haut. si ça marche toujours pas essaye de lancer ton fichier .xls sous dos pour voir s'il fonctionne.String cmd = "excel c:\\cablageFT.xls";
Oui une erreur d'accès fichier, il faut écrire toute l'arborescence!
Pas facile merci!
En revanche c'est pas terrible pour la portabilité de l'application...
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 package PackageExcel; import java.io.*; public class ExcelOuvrirFichier { public static void main(String[] args) throws IOException { try{ //Lancer excel en indiquant l'URL //Runtime run = Runtime.getRuntime(); //Commande shell Windows (présence du fichier c:/cablageFT.xls //String cmd = "excel.exe c:/cablageFT.xls"; String cmd = "C:\\Program Files\\Microsoft Office\\OFFICE11\\EXCEL.EXE C:\\cablageFT.xls"; Runtime.getRuntime().exec(cmd); //Desktop lanceur = Desktop.getDesktop(); //File fichier = new File("excel.exe c:/cablageFT.xls"); } catch(IOException e) { e.printStackTrace(); } } }
bonjour,
Je suis totalement bloquée, j'ai essayé le code ci-dessus dans netbeans après un: private void jToggleButton1ActionPerformed(java.awt.event.ActionEvent evt) {
if (evt.getActionCommand().equals("Valider"))
ça me marche pas, j'ai cette erreur:java.io.IOException: Cannot run program "C:\Classeur1.xls": CreateProcess error=193, %1 nest pas une application Win32 valid
est-ce que vous pouriez m'aider?
je ne connais ta commande exacte mais as-tu essayé d'utiliser la fonction exec avec un tableau de String?
public Process exec(String[] cmdarray)
throws IOException
Partager