Hello,
I try to open a blank document from c-sharp exe but it crash on :
unoidl.com.sun.star.frame.XComponentLoader mxCLoader = (unoidl.com.sun.star.frame.XComponentLoader)xDesktop;
with the error :
System.InvalidCastException: can not cast transparent proxy to unoidl.com.sun.star.frame.XComponentLoader
LibreOffice is started with : D:\Software\LibreOfficePortable701\App\libreoffice\program\soffice.exe “-accept=pipe,name=hexa33;urp” .
The object return by xAppFactory.createInstanceWithContext(“com.sun.star.frame.Desktop”, xAppContext); seems not to be empty :
Console.WriteLine(oDesktop) return : Uno object proxy. OID: bb94e48;msci[0];996511b766734d29b4b5b172ab77d0a0
Where is my mistake ?
Thanks.
My program.cs (light):
unoidl.com.sun.star.uno.XComponentContext mContext = uno.util.Bootstrap.defaultBootstrap_InitialComponentContext();
unoidl.com.sun.star.bridge.XUnoUrlResolver xUrlResolver = unoidl.com.sun.star.bridge.UnoUrlResolver.create(mContext);
Object oObject = xUrlResolver.resolve("uno:pipe,name=hexa33;urp;StarOffice.ServiceManager");
unoidl.com.sun.star.lang.XMultiComponentFactory xMCFactory = (unoidl.com.sun.star.lang.XMultiComponentFactory)oObject;
unoidl.com.sun.star.beans.XPropertySet xPropertySet= (unoidl.com.sun.star.beans.XPropertySet)xMCFactory;
uno.Any property = xPropertySet.getPropertyValue("DefaultContext");
unoidl.com.sun.star.uno.XComponentContext xAppContext = (unoidl.com.sun.star.uno.XComponentContext) property.Value;
unoidl.com.sun.star.lang.XMultiComponentFactory xAppFactory = xAppContext.getServiceManager();
Object oDesktop =xAppFactory.createInstanceWithContext("com.sun.star.frame.Desktop", xAppContext);
Console.WriteLine(oDesktop);
unoidl.com.sun.star.frame.XComponentLoader mxCLoader = (unoidl.com.sun.star.frame.XComponentLoader)xDesktop;