Advertisement
Guest User

UnoClient

a guest
Mar 23rd, 2011
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.85 KB | None | 0 0
  1. public class UnoClient {
  2.  
  3.     public static void main(String[] args) {
  4.         AbstractOpenOfficeConnection cnx = null;
  5.        
  6.         try {
  7.             cnx = new PipeOpenOfficeConnection( "somename" );
  8.             System.out.println("Connecting to OOo...");
  9.             cnx.connect();
  10.            
  11.             System.out.println( "Trying to get the component context" );
  12.             if ( cnx.getComponentContext() != null ) {
  13.                 XComponentContext xCtx = cnx.getComponentContext();
  14.                
  15.                 // TODO Use the UNO connection here
  16.                
  17.             }
  18.         } catch (Exception e) {
  19.             e.printStackTrace();
  20.         } finally {
  21.             if ( cnx != null ) {
  22.                 System.out.println( "Disconnecting from OOo..." );
  23.                 cnx.disconnect();
  24.             }
  25.         }
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement