OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

How to get a path where all the templates are kept by user?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Lusithania
General User
General User


Joined: 04 Feb 2004
Posts: 9
Location: Poland

PostPosted: Tue Feb 10, 2004 1:44 am    Post subject: How to get a path where all the templates are kept by user? Reply with quote

I have a little problem.
I don't know how to get a path which indicates OpenOffice where the aplication should seek for templates.
This path could be setup and changed by a user in Tools -> Options -> OpenOffice.org -> Paths -> Templates.
I think that there must be some function which will do it.
In MS Office it looks like this:

Code:

 temp = Options.DefaultFilePath (wdUserTemplatesPath)
 temp = temp + "\" + FileName + ".dot"


Thank you for help in advance.[/code]
Back to top
View user's profile Send private message Send e-mail
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Tue Feb 10, 2004 6:06 am    Post subject: Reply with quote

Slight alteration of my code to find the user's default work directory.
Code:
GlobalScope.BasicLibraries.LoadLibrary("Tools")
TemURL = GetPathSettings("Template") ' "Template" is case sensitive.
Print TemURL
Back to top
View user's profile Send private message
Lusithania
General User
General User


Joined: 04 Feb 2004
Posts: 9
Location: Poland

PostPosted: Wed Feb 11, 2004 12:21 am    Post subject: Reply with quote

Thank you very much. It was really helpfull and it worked.

Can you tell me where did you learn such things and where can I find information about all functions which can be used in macros in OOo? But please don't tell me that you use only Developers Guide because I cannot find it useful at all.

Regards
Lusithania
Back to top
View user's profile Send private message Send e-mail
JohnV
Administrator
Administrator


Joined: 07 Mar 2003
Posts: 9183
Location: Lexinton, Kentucky, USA

PostPosted: Wed Feb 11, 2004 5:06 am    Post subject: Reply with quote

Pure detective work. I knew OO needed the same information you and I were looking for and hoped it used a macro to find it. I then looked through the various other libraries avail in the macro area until I found a likely looking macro. Copied and pasted it as document macro, ran it and worked from there.

I went through several until I found what I was looking for and then had to figure out how to make return the value I wanted.
Back to top
View user's profile Send private message
Lusithania
General User
General User


Joined: 04 Feb 2004
Posts: 9
Location: Poland

PostPosted: Wed Feb 11, 2004 6:56 am    Post subject: Reply with quote

So You must be a good detective or a computer programmer. Cool
Back to top
View user's profile Send private message Send e-mail
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Wed Feb 11, 2004 11:05 am    Post subject: Reply with quote

There is some other discussion of this

http://www.oooforum.org/forum/viewtopic.php?t=4913
http://www.oooforum.org/forum/viewtopic.php?t=4613
http://www.oooforum.org/forum/viewtopic.php?t=3707

which ends up using the PathSettings service. The advantage of the PathSettings service is that it is part of the API and works in any programming language.

Especially this message...
http://www.oooforum.org/forum/viewtopic.php?p=14048#14048

Change "Work" to "Template".
Code:
   oPathSettings = CreateUnoService( "com.sun.star.util.PathSettings" )
   MsgBox( oPathSettings.Template )

_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group