[Solved] C# API How to start OOo without Registration Wizard

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
sinxxx
Posts: 20
Joined: Mon Jun 07, 2010 4:01 am

[Solved] C# API How to start OOo without Registration Wizard

Post by sinxxx »

hi,

How can I Bootstrap the OOo without Registration Wizard by c# by API?
or how can I Know the Registraton Wizard process was closed when I Bootstrap the OOo?

for example :

The first time the OpenOffice.org be started,
when my main Process bootstrap the OOo: "XComponentContext oStrap = uno.util.Bootstrap.bootstrap();",
the "Registration Wizard" will be opened, then "cancel" or "close" the "Registration Wizard",
though the "Registration Wizard" process be disposed, the main process will still wait for it.
Last edited by sinxxx on Wed Oct 20, 2010 1:01 pm, edited 1 time in total.
openoffice 3.2 for windows
ansj
Posts: 9
Joined: Sun Sep 26, 2010 9:47 am

Re: [C# API] How to start OOo without Registration Wizard

Post by ansj »

when you install over OOo , you change not registration ...once ....it dos not show ..up
OpenOffice 3.1
User avatar
therabi
Volunteer
Posts: 763
Joined: Wed Sep 01, 2010 10:01 pm
Location: USA

Re: [C# API] How to start OOo without Registration Wizard

Post by therabi »

sinxxx wrote:hi,

How can I Bootstrap the OOo without Registration Wizard by c# by API?
or how can I Know the Registraton Wizard process was closed when I Bootstrap the OOo?

for example :

The first time the OpenOffice.org be started,
when my main Process bootstrap the OOo: "XComponentContext oStrap = uno.util.Bootstrap.bootstrap();",
the "Registration Wizard" will be opened, then "cancel" or "close" the "Registration Wizard",
though the "Registration Wizard" process be disposed, the main process will still wait for it.
Have you checked the Administration at http://wiki.services.openoffice.org/wik ... tion_Guide ? On the right hand is a list of chapters. The sixth item on the list cover you request.

HTH
OpenOffice.org v3.3, LibO v3.32 on Ubuntu 10.10 and Win7
sinxxx
Posts: 20
Joined: Mon Jun 07, 2010 4:01 am

Re: [C# API] How to start OOo without Registration Wizard

Post by sinxxx »

hi,

well I mean that to start OOo without Registration Wizard by API.
such as

Code: Select all

uno.util.Bootstrap.bootstrap();
openoffice 3.2 for windows
hol.sten
Volunteer
Posts: 495
Joined: Mon Oct 08, 2007 1:31 am
Location: Hamburg, Germany

Re: [C# API] How to start OOo without Registration Wizard

Post by hol.sten »

sinxxx wrote:hi,

well I mean that to start OOo without Registration Wizard by API.
such as

Code: Select all

uno.util.Bootstrap.bootstrap();
As far as I know, you must at least run once through the First Start Wizard. Only way to get around it is to use the parameter -nofirststartwizard for starting OOo. Although I have no idea how to use that parameter from C#.
OOo 3.2.0 on Ubuntu 10.04 • OOo 3.2.1 on Windows 7 64-bit and MS Windows XP
User avatar
therabi
Volunteer
Posts: 763
Joined: Wed Sep 01, 2010 10:01 pm
Location: USA

Re: [C# API] How to start OOo without Registration Wizard

Post by therabi »

sinxxx wrote:hi,

well I mean that to start OOo without Registration Wizard by API.
such as

Code: Select all

uno.util.Bootstrap.bootstrap();
Did I you look at the link? There is a section on how to bypass the Reg Wizard.
OpenOffice.org v3.3, LibO v3.32 on Ubuntu 10.10 and Win7
sinxxx
Posts: 20
Joined: Mon Jun 07, 2010 4:01 am

Re: [C# API] How to start OOo without Registration Wizard

Post by sinxxx »

therabi wrote:
sinxxx wrote:hi,

well I mean that to start OOo without Registration Wizard by API.
such as

Code: Select all

uno.util.Bootstrap.bootstrap();
Did I you look at the link? There is a section on how to bypass the Reg Wizard.
hi,

what this link told is using the .oxt file to deactivating the RegWizard,

but I dont not have any Roles to patch this .oxt file to SB's OS.
openoffice 3.2 for windows
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: [C# API] How to start OOo without Registration Wizard

Post by hanya »

An example:

Code: Select all

unoidl.com.sun.star.uno.XComponentContext xContext = null;

Microsoft.Win32.RegistryKey regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
        @"SOFTWARE\OpenOffice.org\UNO\InstallPath", false);
if (regkey == null)
    return;

string installPath = (string)regkey.GetValue("");
if (installPath == null)
    return;

string officePath = installPath + @"\soffice.exe";
string officeParams = " -nodefault -nologo -nofirststartwizard";
string unoParams = " -accept=pipe,name=officepipe1;urp;StarOffice.ServiceManager";

System.Environment.SetEnvironmentVariable(
    "URE_BOOTSTRAP", "vnd.sun.star.pathname:" + installPath + "/fundamental.ini");

System.Diagnostics.Process p = System.Diagnostics.Process.Start(officePath, officeParams + unoParams);

XComponentContext xLocalContext = uno.util.Bootstrap.defaultBootstrap_InitialComponentContext();
XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
XUnoUrlResolver xUrlResolver = (XUnoUrlResolver) xLocalServiceManager.createInstanceWithContext(
    "com.sun.star.bridge.UnoUrlResolver", xLocalContext);


int i = 0;
while (i < 20) {
    try
    {
        xContext = (XComponentContext)xUrlResolver.resolve(
            "uno:pipe,name=officepipe1;urp;StarOffice.ComponentContext");
        if (xContext != null)
            break;
    } catch (unoidl.com.sun.star.connection.NoConnectException) {
        System.Threading.Thread.Sleep(100);
    }
    i++;
}
if (xContext == null)
    return;

XMultiServiceFactory xMsf = (XMultiServiceFactory) xContext.getServiceManager();

Object desktop = xMsf.createInstance("com.sun.star.frame.Desktop");
XComponentLoader xLoader = (XComponentLoader)desktop;
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
sinxxx
Posts: 20
Joined: Mon Jun 07, 2010 4:01 am

Re: [C# API] How to start OOo without Registration Wizard

Post by sinxxx »

hanya wrote:An example:

Code: Select all

unoidl.com.sun.star.uno.XComponentContext xContext = null;

Microsoft.Win32.RegistryKey regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(
        @"SOFTWARE\OpenOffice.org\UNO\InstallPath", false);
if (regkey == null)
    return;

string installPath = (string)regkey.GetValue("");
if (installPath == null)
    return;

string officePath = installPath + @"\soffice.exe";
string officeParams = " -nodefault -nologo -nofirststartwizard";
string unoParams = " -accept=pipe,name=officepipe1;urp;StarOffice.ServiceManager";

System.Environment.SetEnvironmentVariable(
    "URE_BOOTSTRAP", "vnd.sun.star.pathname:" + installPath + "/fundamental.ini");

System.Diagnostics.Process p = System.Diagnostics.Process.Start(officePath, officeParams + unoParams);

XComponentContext xLocalContext = uno.util.Bootstrap.defaultBootstrap_InitialComponentContext();
XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
XUnoUrlResolver xUrlResolver = (XUnoUrlResolver) xLocalServiceManager.createInstanceWithContext(
    "com.sun.star.bridge.UnoUrlResolver", xLocalContext);


int i = 0;
while (i < 20) {
    try
    {
        xContext = (XComponentContext)xUrlResolver.resolve(
            "uno:pipe,name=officepipe1;urp;StarOffice.ComponentContext");
        if (xContext != null)
            break;
    } catch (unoidl.com.sun.star.connection.NoConnectException) {
        System.Threading.Thread.Sleep(100);
    }
    i++;
}
if (xContext == null)
    return;

XMultiServiceFactory xMsf = (XMultiServiceFactory) xContext.getServiceManager();

Object desktop = xMsf.createInstance("com.sun.star.frame.Desktop");
XComponentLoader xLoader = (XComponentLoader)desktop;
hi,

it works well for me,
thanks.
openoffice 3.2 for windows
Post Reply