Moin,

Juergen Schmidt schrieb:
> 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.

The property is "MacroExecutionMode":

            PropertyValue[] DocArgs = new PropertyValue[1];
            PropertyValue DocArg = new PropertyValue();
            DocArg.Name = "MacroExecutionMode";
            DocArg.Value = new Short(
com.sun.star.document.MacroExecMode.ALWAYS_EXECUTE_NO_WARN);
            DocArgs[0] = DocArg;


so you can:

loadComponentFromURL(DocURL, "MyDoc", "_blank", DocArgs);


Hope that helps,
Christoph

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

Reply via email to