3 messages in org.openoffice.fr.progRE: [prog] Propriètés d'un document w...
FromSent OnAttachments
FAouzi AbderrahmanJun 20, 2006 5:06 am 
Emilie BassoJun 20, 2006 6:00 am 
Francois GattoJun 20, 2006 8:24 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:RE: [prog] Propriètés d'un document writerActions...
From:Emilie Basso (mili@hotmail.fr)
Date:Jun 20, 2006 6:00:04 am
List:org.openoffice.fr.prog

voici les MediaDescriptor de com.sun.star.document :

http://api.openoffice.org/docs/common/ref/com/sun/star/document/MediaDescriptor.html

voici le code pour ouvrir un document

public class DocOffice { private XComponentLoader xComponentLoader = null; private XComponentContext xRemoteContext = null; private XMultiComponentFactory xRemoteServiceManager = null; private XComponent xWriterComponent; private Object xDesktop;

/** * Create a new instance of DocOffice */ public DocOffice() {}

public void openDoc() { try { useWriter(); } catch (java.lang.Exception e) { System.err.println(e.getMessage()); e.printStackTrace(); } }

/** * crée un nouveau document contenant le fichier de chemin HtmlPath * @param HtmlPath chemin du fichier html à charger dans le document vierge * @throws java.lang.Exception */ private void useWriter() throws java.lang.Exception { try { // create new writer document xWriterComponent = newDocComponent();

//INSERER FICHIER XTextDocument xTextDocument = (XTextDocument)UnoRuntime.queryInterface(XTextDocument.class, xWriterComponent); XText xText = xTextDocument.getText(); XTextCursor cursor= xText.createTextCursor(); cursor.gotoEnd(false); XDocumentInsertable docInsert = (XDocumentInsertable) UnoRuntime.queryInterface(XDocumentInsertable.class, cursor); docInsert.insertDocumentFromURL("monFichier.doc", new PropertyValue[0]); cursor.gotoEnd(false); // FIN INSERER FICHIER } catch( com.sun.star.lang.DisposedException e ) { xRemoteContext = null; throw e; } }

/** * charge le document dans une fenêtre OOoWriter */ private XComponent newDocComponent() throws java.lang.Exception { String loadUrl = "private:factory/swriter" ; if (xRemoteContext == null && xRemoteServiceManager == null) { try { // get the remote office component context xRemoteContext = com.sun.star.comp.helper.Bootstrap.bootstrap(); xRemoteServiceManager = xRemoteContext.getServiceManager(); } catch( Exception e) { e.printStackTrace(); System.exit(1); } } // get the Desktop, we need its XComponentLoader interface to load a new document xDesktop = xRemoteServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", xRemoteContext); // query the XComponentLoader interface from the desktop xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(XComponentLoader.class, xDesktop); // create empty array of PropertyValue structs, needed for loadComponentFromURL and set its member fields // C EST ICI QUE TU UTILISES LES PROPRIETES PropertyValue[] loadProps = new PropertyValue[1]; loadProps[0] = new PropertyValue(); loadProps[0].Name = "Hidden"; loadProps[0].Value = new Boolean (false); //true pour cacher l'ouverture de l'application /*loadUrl = "monFichier.doc" pour charger un ficher existant */ // load return xComponentLoader.loadComponentFromURL(loadUrl, "_blank", 0, loadProps); }

public void closeDoc () throws Exception { // Fermer le document XCloseable xClose = (XCloseable)UnoRuntime.queryInterface(XCloseable.class, xWriterComponent); xClose.close(true); } }

From: "FAouzi Abderrahman" <fa@prosig.fr>

Reply-To: pr@fr.openoffice.org To: <pr@fr.openoffice.org> Subject: [prog] Propriètés d'un document writer Date: Tue, 20 Jun 2006 14:06:45 +0200

Bonjour à tous et à toutes,

Je voudrais savoir où je pourrais trouver la liste de complète des propriétés d’un document wrtier avant son ouverture (exemple readonly, hidden..) et comment je pourrais l’utiliser avant l’ouverture d’un doucement ?

Merci d’avance

_________________________________________________________________ Windows Live Mail : découvrez et testez la version bêta ! http://www.ideas.live.com/programpage.aspx?versionId=5d21c51a-b161-4314-9b0e-4911fb2b2e6d