1 using System; 2 using unoidl.com.sun.star.lang; 3 using unoidl.com.sun.star.uno; 4 using unoidl.com.sun.star.bridge; 5 using unoidl.com.sun.star.frame; 6 7 class DynLoad 8 { 9 10 static void Main(string[] args) 11 { 12 connect(args); 13 } 14 15 /** Connect to a running office that is accepting connections. 16 @return The ServiceManager to instantiate office components. */ 17 static private XMultiServiceFactory connect( string[] args ) 18 { 19 if (args.Length == 0) 20 Console.WriteLine("You need to provide a file URL to the office" + 21 " program folder\n"); 22 System.Collections.Hashtable ht = new System.Collections.Hashtable(); 23 ht.Add( "SYSBINDIR", args[ 0 ] ); 24 XComponentContext xContext = 25 uno.util.Bootstrap.defaultBootstrap_InitialComponentContext( 26 args[ 0 ] + "/uno.ini", ht.GetEnumerator() ); 27 28 if (xContext != null) 29 Console.WriteLine("Successfully created XComponentContext\n"); 30 else 31 Console.WriteLine("Could not create XComponentContext\n"); 32 33 return null; 34 } 35 } 36