[Issue] Use of TemplateRegionName Property

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
rbenrey
Posts: 3
Joined: Sat Jun 28, 2008 5:01 pm

[Issue] Use of TemplateRegionName Property

Post by rbenrey »

I've been trying to write a Dispatcher/Uno:NewDoc macro that applies the TemplateRegionName and TemplateName properties. The idea is to launch a new doc from a template named 10Envelope via the usual template dialog. (I have several successful macros that open templates, but I have to provide specific paths).

Back in VBA for Word, I could simply supply a template name, rather than a complete path\filename. I've tried many variations on the following. but all they do is take me to the Template dialog ... and wait for me to click on a specific template. The sparce documentation I've found says that TemplateRegionName should be set to name that appears in the dialog. I suspect the problem lies there.

Code: Select all

sub Launch
  dim document   as object
  dim dispatcher as object
  dim args1(2) as new com.sun.star.beans.PropertyValue
	args1(0).Name = "TemplateRegionName"
	args1(0).Value = "My Templates"
	args1(1).Name = "TemplateName"
	args1(1).Value = "10Envelope"

  document   = ThisComponent.CurrentController.Frame
  dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
  dispatcher.executeDispatch(document, ".uno:NewDoc", "", 0, args1())

end sub
Any thoughts?

Thanks,

Ron Benrey
Last edited by Hagar Delest on Mon Jun 30, 2008 11:32 am, edited 4 times in total.
Reason: Tagged the thread as issue (link to a bug report).
OOo 2.4.X on Ubuntu 8.x + Windows XP
hanya
Volunteer
Posts: 885
Joined: Fri Nov 23, 2007 9:27 am
Location: Japan

Re: Use of TemplateRegionName Property

Post by hanya »

There is a problem creating a new document from templates with TemplateRegionName property and issued:
http://www.openoffice.org/issues/show_bug.cgi?id=82287
Unfortunately, you need to pass complete path of the template file to the loader.
Please, edit this thread's initial post and add "[Solved]" to the subject line if your problem has been solved.
Apache OpenOffice 4-dev on Xubuntu 14.04
rbenrey
Posts: 3
Joined: Sat Jun 28, 2008 5:01 pm

Re: Solved: Use of TemplateRegionName Property

Post by rbenrey »

Thanks! After trying a dozen variations, I began to assume it wasn't implemented. Maybe in the future!

Ron
OOo 2.4.X on Ubuntu 8.x + Windows XP
Post Reply