List Info

Thread: macro not working when OO started via Java API




macro not working when OO started via Java API
user name
2007-02-15 06:39:29
Hi,

I'm using the Java bootstrap method to open a OO Writer
document as
described in:

http://codesnippets.services.o
penoffice.org/Office/Office.BootstrapOpenOffice.snip


However, when there are macros included in the document that
I'm opening,
the user gets no Alert that the document contains macro's.
The macros
are present, but they do nothing when the users calls them
via the OO GUI.
When opening openoffice normally via Windows, I get  a
warning, and
the macros work.

I tried to play with the macro security settings but to no
avail.

Can I solve this problem programmaticly, or is this a bug ?

thx,

Dominique De Munck

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: macro not working when OO started via Java API
user name
2007-02-15 07:39:52
Dominique De Munck schrieb:

> Hi,
> 
> I'm using the Java bootstrap method to open a OO Writer
document as
> described in:
> 
> http://codesnippets.services.o
penoffice.org/Office/Office.BootstrapOpenOffice.snip
> 
> 
> However, when there are macros included in the document
that I'm opening,
> the user gets no Alert that the document contains
macro's. The macros
> are present, but they do nothing when the users calls
them via the OO GUI.
> When opening openoffice normally via Windows, I get  a
warning, and
> the macros work.
> 
> I tried to play with the macro security settings but to
no avail.
> 
> Can I solve this problem programmaticly, or is this a
bug ?

I assume that you didn't specify the MacroExecMode:

http://api.openoffice.org/docs
/common/ref/com/sun/star/document/MacroExecMode.html

It has to be provided in the MediaDescriptor (the arguments
sent with
the loadComponentFromURL call) as described at

http://api.open
office.org/docs/DevelopersGuide/OfficeDev/OfficeDev.xhtml#1_
1_5_Handling_Documents

You also should add the DocumentUpdateMode.

http://api.openoffice.org/docs
/common/ref/com/sun/star/document/UpdateDocMode.html

Ciao,
Mathias


-- 
Mathias Bauer (mba) - Project Lead OpenOffice.org Writer
OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
Please don't reply to "nospamformbagmx.de".
I use it for the OOo lists and only rarely read other mails
sent to it.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: macro not working when OO started via Java API
user name
2007-02-15 11:13:23
your assumption was right! I did search in the developer
docs on this,
but got a bit lost.

Thanx a lot !


for the record, this is how I did it:



PropertyValue[] myProperties = new PropertyValue[3];
    	myProperties[0] = new PropertyValue();
    	myProperties[0].Name = "Hidden";
    	// for open document and do not show user interface use
"true"
    	myProperties[0].Value = new Boolean(false);
    	
    	myProperties[1] = new PropertyValue();
    	myProperties[1].Name = 
"MacroExecutionMode";
    	myProperties[1].Value =  new
Short(MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
    	
    	myProperties[2] = new PropertyValue();
    	myProperties[2].Name =  "UpdateDocMode";
    	myProperties[2].Value =  new
Short(UpdateDocMode.ACCORDING_TO_CONFIG);
    	
    	// Load a given document
    	try	{
    		 xComponent = xComponentLoader.loadComponentFromURL(
    				source_File,  // For createUNOFileURL see:
../Office/Office.CreateUNOCompatibleURL.snip
    				"_blank",                       // New
windos
    				0,                              // Is ignored
    				myProperties);            // Special properties
    	}




On 2/15/07, Mathias Bauer <nospamforMBAgmx.de> wrote:
> Dominique De Munck schrieb:
>
> > Hi,
> >
> > I'm using the Java bootstrap method to open a OO
Writer document as
> > described in:
> >
> > http://codesnippets.services.o
penoffice.org/Office/Office.BootstrapOpenOffice.snip
> >
> >
> > However, when there are macros included in the
document that I'm opening,
> > the user gets no Alert that the document contains
macro's. The macros
> > are present, but they do nothing when the users
calls them via the OO GUI.
> > When opening openoffice normally via Windows, I
get  a warning, and
> > the macros work.
> >
> > I tried to play with the macro security settings
but to no avail.
> >
> > Can I solve this problem programmaticly, or is
this a bug ?
>
> I assume that you didn't specify the MacroExecMode:
>
> http://api.openoffice.org/docs
/common/ref/com/sun/star/document/MacroExecMode.html
>
> It has to be provided in the MediaDescriptor (the
arguments sent with
> the loadComponentFromURL call) as described at
>
> http://api.open
office.org/docs/DevelopersGuide/OfficeDev/OfficeDev.xhtml#1_
1_5_Handling_Documents
>
> You also should add the DocumentUpdateMode.
>
> http://api.openoffice.org/docs
/common/ref/com/sun/star/document/UpdateDocMode.html
>
> Ciao,
> Mathias
>
>
> --
> Mathias Bauer (mba) - Project Lead OpenOffice.org
Writer
> OpenOffice.org Engineering at Sun: http://blogs.sun.com/Gu
llFOSS
> Please don't reply to "nospamformbagmx.de".
> I use it for the OOo lists and only rarely read other
mails sent to it.
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
> For additional commands, e-mail: dev-helpapi.openoffice.org
>
>

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


Re: macro not working when OO started via Java API
country flaguser name
Australia
2007-02-15 15:52:48
On 16/02/2007, at 12:39 AM, Mathias Bauer wrote:

> Dominique De Munck schrieb:
>
>> Hi,
>>
>> I'm using the Java bootstrap method to open a OO
Writer document as
>> described in:
>>
>> h
ttp://codesnippets.services.openoffice.org/Office/ 
>> Office.BootstrapOpenOffice.snip
>>
>>
>> However, when there are macros included in the
document that I'm  
>> opening,
>> the user gets no Alert that the document contains
macro's. The macros
>> are present, but they do nothing when the users
calls them via the  
>> OO GUI.


The "do nothing" issue is reported here:
http://qa.openoffice.org/issues/show_bug.cgi?id=74177
Perhaps you could add a comment about the case using a
macro.

thanks

Jim




>> When opening openoffice normally via Windows, I get
 a warning, and
>> the macros work.
>>
>> I tried to play with the macro security settings
but to no avail.
>>
>> Can I solve this problem programmaticly, or is this
a bug ?
>
> I assume that you didn't specify the MacroExecMode:
>
> http://api.openoffice.org/docs/common/ref/com/su
n/star/document/ 
> MacroExecMode.html
>
> It has to be provided in the MediaDescriptor (the
arguments sent with
> the loadComponentFromURL call) as described at
>
> http://api.openoffice.org/docs/DevelopersGuide/OfficeDe
v/ 
> OfficeDev.xhtml#1_1_5_Handling_Documents
>
> You also should add the DocumentUpdateMode.
>
> http://api.openoffice.org/docs/common/ref/com/su
n/star/document/ 
> UpdateDocMode.html
>
>



------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org


[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )