Oliver Specht - Sun Germany -Hamburg wrote:

> Juergen Schmidt wrote:
>> Hi Cedric,
>>
>> Cedric Bosdonnat wrote:
>>> Hi all,
>>>
>>> I'm developping a macro using and updating User Text fields in a 
>>> document template. I have two options to create the document:
>>>   1 - File > New > Documents and Templates
>>>   2 - loadComponentURL()
>>>
>>> The macro is executed at the document creation. When creating the 
>>> document with method (1) there is no problem: the User fields are 
>>> updated. But when creating the document with method (2) the macro 
>>> cannot find any text field in the document. The following code 
>>> returns false instead of true:
>>>
>>> ThisComponent.getTextFields().createEnumeration().hasMoreElements()
>>>
>>> Is this a (known) bug ? Is there something to do with the 
>>> loadComponentFromURL ? Note that the macro works fine if I disable 
>>> the macro assignement att the document creation and run it just after 
>>> the loadComponentFromURL.
>>
>> Either a bug or you have to set an additional property in the 
>> MediaDescriptor which i am currently don't know. Hope Andreas Schluens 
>> can help here.
>>
>> Juergen
>>
> Hi,
> are you sure the macro is executed at all?
> 
> I tried it on an m193 and the macro isn't executed when I open the 
> document via loadComponentFromURL() (also if macro security is set to low).
> 
> When I open the document manually everything works fine.

Good point. When opened with loadComponentFromURL() macros aren't
executed by default. You have to specify additional parameters that in
case you open a document from the GUI are provided automatically. The
reason for this is that the default treatment of documents via API
should happen in a way that the macros are not interrupted by dialogs
popping up.

The necessary parameters are "UpdateDocMode" and "MacroExecutionMode".
You can find documentation for them in the Developers' Guide (in the
section about the MediaDescriptor).

Ciao,
Mathias
-- 
Mathias Bauer - OpenOffice.org Application Framework Project Lead
Please reply to the list only, [EMAIL PROTECTED] is a spam sink.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to