Open Writer at particular Heading or Bookmark?

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Sigurd
Posts: 21
Joined: Sun Jul 27, 2008 2:42 am

Open Writer at particular Heading or Bookmark?

Post by Sigurd »

Is there a command line command that will open a given file to the appropriate headline in Writer?

Background...

Freemind is an application that builds relationship maps between headings, urls, or whatever. The result is a tree of data, stored in xml, displayed in a WYSIWYG interface. For any item, it has the option of storing a link to a web page or file. I would like to write the link in such a way that if I click on the link it opens an OO3 file to the right headline or bookmark. If possible I'd like multiple links to the same file to move around the viewer in _one_ open file. I don't want a bazillion different files and I'd like to skip a table of contents or hyperlink list.

I know that I can create hyperlinks to headings for use within OO 3.0 documents. Can I expose this to the command line in Windows XP?

Chiefly I want to do this in Writer but if it can be done in other parts of the suite that would be wonderful.

Any help appreciated.

Thanks for reading.

Sigurd
OOo 3.1.X on Ms Windows XP + Linux(s)
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Open Writer at particular Heading or Bookmark?

Post by acknak »

Sure:
path\to\ooo\program\soffice.exe file://path/to/document/somedocument.odt#bookmarkname
AOO4/LO5 • Linux • Fedora 23
Sigurd
Posts: 21
Joined: Sun Jul 27, 2008 2:42 am

Re: Open Writer at particular Heading or Bookmark?

Post by Sigurd »

Thanks so much for the reply but it doesn't seem to be working.

Perhaps I have my slash direction wrong?

This is the actual line.

C:\Program Files\OpenOffice.org 3\program\swriter.exe D:\RPG stuff\01 Active Game\DM - WIP.odt#1.1.4.30.Rescue Husks|outline


Sigurd
OOo 3.1.X on Ms Windows XP + Linux(s)
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Open Writer at particular Heading or Bookmark?

Post by acknak »

I can't tell you specifically what to use because I don't have a Windows system to test with, but you at least need to put quotes around paths that include spaces.

First check that the program path works; try something like
"C:\Program Files\OpenOffice.org 3\program\swriter.exe"
and OOo Writer should start with a new empty document.

Then you can add the document URL to end of the program path, with a not-quoted space in between:
"C:\Program Files\OpenOffice.org 3\program\swriter.exe" "file:///D:/RPG stuff/01 Active Game/DM - WIP.odt#1.1.4.30.Rescue Husks|outline"
The slashes in the program path must lean to the left (a Windows file path); the slashes in the document URL must lean to the right (an Internet URL).
AOO4/LO5 • Linux • Fedora 23
Post Reply