| View previous topic :: View next topic |
| Author |
Message |
amit_batra Newbie


Joined: 16 Dec 2003 Posts: 3
|
Posted: Mon Jan 12, 2004 5:03 am Post subject: Preventing OpenOffice GUI Dialogs from Popping |
|
|
Hi All,
I need to drive OpenOffice.org application from my Java code. For this purpose I open a document using the "hidden" option, so that nothing is visible on screen, and then process the document while it remains hidden.
The problem is that sometimes while opening, saving, printing or performing other operations on the document, a GUI dialog opens asking the user for some sort of confirmation or some message (like unable to open the document).
Since the OpenOffice.org application is being driven by another process (not by the user), I would like to prevent the popping of these dialogs. Specifically, my requirement is:
1. If possible, prevent the dialogs from popping up and instead get some sort of notification that my code can respond to.
2. If the above is not possible, then determine what the dialog is asking the user to do and do that programatically.
Can anybody provide any pointers to achieve 1 & 2 in the most efficient manner?
Regards,
Amit
Here is the existing code snippet:
| Code: |
// Preparing properties for loading the document
PropertyValue properties[] = new PropertyValue[1];
// Setting the flag for hiding the open document
properties[0] = new PropertyValue();
properties[0].Name = "Hidden";
properties[0].Value = Boolean.TRUE;
// Loading the Wanted Document
xLoadedDocument = xComponentloader.loadComponentFromURL(
sourceUrl,
"_blank",
0,
properties
);
// Perform other operations on the document
...
|
|
|
| Back to top |
|
 |
Guest
|
Posted: Mon Jan 12, 2004 7:33 am Post subject: Re: Preventing OpenOffice GUI Dialogs from Popping |
|
|
Hi Amit,
you can get rid of dialogs popping up by starting OpenOffice with the -invisible or -headless parameters. For a list of all parameters start OpenOffice with
I'm not aware of the possibility of getting information about the error was other than receiving (and if possible handling) a corresponding exception.
best regards,
Oliver |
|
| Back to top |
|
 |
DannyB Moderator


Joined: 02 Apr 2003 Posts: 3991 Location: Lawrence, Kansas, USA
|
|
| Back to top |
|
 |
amit_batra Newbie


Joined: 16 Dec 2003 Posts: 3
|
Posted: Tue Jan 13, 2004 7:12 am Post subject: Headless Option Works |
|
|
Thanks guys, the "-headless" option seems to supress the dialogs. However I am yet to see my Java code catch an exception in case of a error generated by OpenOffice (for which it would have popped a dialog in the normal course of events). If this happens, that would be the ideal solution.
Thanks again.  |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Fri Oct 29, 2004 2:04 pm Post subject: |
|
|
Change it to:
| Code: |
properties[0].Name = "Hidden";
properties[0].Value = new Boolean(true);
|
Maybe that's the problem.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
|