| View previous topic :: View next topic |
| Author |
Message |
freyc Newbie

Joined: 27 Sep 2006 Posts: 1
|
Posted: Wed Sep 27, 2006 2:09 pm Post subject: how to get the document name in a macro |
|
|
I am trying to write an Ooo macro for calc. I need to get the name of my document to set my args before to do a uno:move operation. I guess it is something close to ThisComponent.getCurrentController.getFrame.name but this is not right
How can I get the document name out of ThisComponent.getCurrentController.getFrame |
|
| Back to top |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Wed Sep 27, 2006 5:18 pm Post subject: |
|
|
I would use ThisComponent.getUrl. There is also ThisComponent.getLocation. I've never looked into the difference, if any; there may only be a difference on Windows because Unix systems use the forward slash in paths. _________________ search forum by month |
|
| Back to top |
|
 |
uros Super User


Joined: 22 May 2003 Posts: 601 Location: Slovenia
|
|
| Back to top |
|
 |
Villeroy Super User


Joined: 04 Oct 2004 Posts: 10065 Location: Germany
|
Posted: Thu Sep 28, 2006 1:41 pm Post subject: |
|
|
This set of named references returns information about URL, path, current sheet-name without macros:
cFilename =CELL("FILENAME")
FilePath =RIGHT(FileURLPath;LEN(FileURLPath)-7)
FileURL =MID(cFilename;2;SEARCH("'#";cFilename)-2)
FileURLPath =MID(cFilename;2;SEARCH("/[^/]+'#";cFilename)-1)
ThisSheet =MID(cFilename;FIND("#$";cFilename)+2;256)
DocName =MID(cFilename;SEARCH("/[^/]+$";cFilename)+1;LEN(cFilename)-FIND("#$";cFilename)+1) _________________ Rest in peace, oooforum.org
Get help on http://forum.openoffice.org |
|
| Back to top |
|
 |
|