Giuseppe Castagno wrote:

>>> I'd like to use the api with templates the way the
>>> "File > New > Template and Document" dialog works, but so far
>>> with no luck.
>>>
>>> Any idea?
>> 
>> It seems to fail for *every* template, not only for those added as
>> extensions. I think this is a bug. I couldn't find any code evaluating
>> the arguments "TemplateRegionName" and "TemplateName". I'm not sure if
>> there is an issue already, but it's possible.
> 
> issue 82287 [1] seems dealing with this same problem, may be it's 
> wrongly assigned?

Yes, thanks for the pointer. I confirmed the issue.

>> The following code should work:
>> 
>>> sub opentemplate
>>>
>>>     dim args(2) as new com.sun.star.beans.PropertyValue
>>>     args(0).Name = "Region"
>>>     args(0).Value = "Finances"
>>>     args(1).Name = "Name"
>>>     args(1).Value = "Car Costs"
>>>     dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
>>>     dispatcher.executeDispatch(StarDesktop, ".uno:NewDoc", "", 0,args())    
>>>     
>>> End Sub
>> 
>> but it doesn't give you a return value. Perhaps this is enough for you?
> 
> It's enough, thank you.
> I retrieve the document as ThisComponent immediately after the call, I 
> hope the call it's synchronous?

The Dispatching is done synchronously, but on some platforms (Linux) the
activation of the new document may be asynchronously so that
"ThisComponent" may not be what you expect.

Ciao,
Mathias

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

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

Reply via email to