Bonjour à tous !
s'il vous plait, aidez-moi !!!!
je cherche à manipuler des fichier sous open office writer en manipulant ce dernier en Java !
quelqu'un a déjà développé avec UNO ???
Bonjour à tous !
s'il vous plait, aidez-moi !!!!
je cherche à manipuler des fichier sous open office writer en manipulant ce dernier en Java !
quelqu'un a déjà développé avec UNO ???
Salut,
Il faut se plonger dans la doc : http://udk.openoffice.org/
C'est ca aussi le boulot de developpeur
a++
Salut! oui, ça fait un peu peur à première vue, mais c pas compliqué, va jetter un coup d'oeil ici:
http://api.openoffice.org/docs/Devel...UNO+Components
le truc c'est que ça fait plus d'une semaine que je cherche dedansmais je voudrait tous simplement ouvrir l'appli, c'est pour le moment la seule chose qui me coince..
la manipulation des objets, je pense pouvoir me débrouiller
mais pour ouvrir un fichier existant dans Open office, avec la fenêtre ouverte... quelqu'un a fait ???
N'import quel programme que je lance, comme celui ci qui est dans le Developers Guide :
j'ai un message qui apparait :
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 public class FirstunoContact { public static void main(String[] args) { try { // get the remote office component context com.sun.star.uno.XComponentContext xContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); com.sun.star.lang.XMultiComponentFactory xMCF = xContext.getServiceManager(); String available = (xMCF != null ? "available" : "not available"); System.out.println( "remote ServiceManager is " + available ); } catch (java.lang.Exception e) { e.printStackTrace(); } finally { System.exit(0); } } }
"Missing vcl ressource. This indicates that files vital to localization are missing. You might have a corrupt installation."
j'ai déja désinstaller et même répérer OOo ...
quelqu'un a déjà rencontrer ce problème ???
Salut !
As-tu vu ce post ?
oui, j'ai lu ce post...
j'ai trouvé mon problème, je n'utilisais pas les bons fichiers jar : ceux à utiliser sont dans le dossier :
C:\Program Files\OpenOffice.org 2.0\program\classes\
il faut importer juh.jar, jurt.jar, unoil.jar, et ridl.jar
Mais j'ai tout de même un petit problème :
je souhaiterais pouvoir ouvrir un document exitant, en entrant son chemin
mais la seule chose que je parviens à faire c'est d'ouvrir un nouveau document vierge.
voici le code
je voudrais pouvoir ouvrir mon fichier, soit directement, soit depuis la fenêtre ouverte...
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 /************************************************************************* * * Ouvrir un document OpenOffice Writer * *************************************************************************/ import com.sun.star.lang.XComponent; import com.sun.star.uno.XComponentContext; import com.sun.star.uno.UnoRuntime; import com.sun.star.frame.XComponentLoader; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.beans.PropertyValue; public class testSimple { private XComponentContext xRemoteContext = null; private XMultiComponentFactory xRemoteServiceManager = null; /** crée une nouvelle instance de testSimple */ public testSimple() {} /** * @param args the command line arguments */ public static void main(String[] args) { testSimple test = new testSimple(); try { test.useDocuments(); } catch (java.lang.Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } finally { System.exit(0); } } protected void useDocuments() throws java.lang.Exception { useWriter(); } protected void useWriter() throws java.lang.Exception { try { // create new writer document and get text, then manipulate text XComponent xWriterComponent = newDocComponent("swriter"); } catch( com.sun.star.lang.DisposedException e ) { //works from Patch 1 xRemoteContext = null; throw e; } } protected XComponent newDocComponent(String docType) throws java.lang.Exception { String loadUrl = "private:factory/" + docType; xRemoteServiceManager = this.getRemoteServiceManager(); Object desktop = xRemoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xRemoteContext); XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, desktop); // the boolean property Hidden tells the office to open a file in hidden mode PropertyValue[] loadProps = new PropertyValue[1]; loadProps[0] = new PropertyValue(); return xComponentLoader.loadComponentFromURL(loadUrl, "_blank", 0, loadProps); } protected XMultiComponentFactory getRemoteServiceManager() throws java.lang.Exception { if (xRemoteContext == null && xRemoteServiceManager == null) { try { // First step: get the remote office component context xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); System.out.println("Connected to a running office ..."); xRemoteServiceManager = xRemoteContext.getServiceManager(); } catch( Exception e) { e.printStackTrace(); System.exit(1); } } return xRemoteServiceManager; } }
Quelqu'un a une piste ???
Partager