Open File function

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Peteron
Posts: 4
Joined: Thu Jun 29, 2017 8:30 pm

Open File function

Post by Peteron »

I would like to insert a macro in my spreadsheet to open a folder /file. Effectively click on a cell and a picture opens up on screen.
Is this a feature of Open Office
Open Office v 4.1.3 running on Windows 10
User avatar
RoryOF
Moderator
Posts: 34612
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Open File function

Post by RoryOF »

You can do this without a macro - /Insert /Hyperlink and point to the file; the system image viewer will open the picture, or change the Hyperlink to use the desired file viewer and the picture file and parameters on the file viewer command line.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Peteron
Posts: 4
Joined: Thu Jun 29, 2017 8:30 pm

Re: Open File function

Post by Peteron »

RoryOF wrote:You can do this without a macro - /Insert /Hyperlink and point to the file; the system image viewer will open the picture, or change the Hyperlink to use the desired file viewer and the picture file and parameters on the file viewer command line.
Thank you Rory. That answers the question and I have looked it up on the "Help". Unfortunately it might as well be written in Klingon . Alas I am a simple spreadsheet user and much of its secrets will always remain so.
Open Office v 4.1.3 running on Windows 10
User avatar
RoryOF
Moderator
Posts: 34612
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Open File function

Post by RoryOF »

Peteron wrote:
RoryOF wrote:You can do this without a macro - /Insert /Hyperlink and point to the file; the system image viewer will open the picture, or change the Hyperlink to use the desired file viewer and the picture file and parameters on the file viewer command line.
Thank you Rory. That answers the question and I have looked it up on the "Help". Unfortunately it might as well be written in Klingon . Alas I am a simple spreadsheet user and much of its secrets will always remain so.
Some people have learned and speak Klingon; it's not impossible
.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
robleyd
Moderator
Posts: 5081
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Open File function

Post by robleyd »

it might as well be written in Klingon
Ask, and ye shall receive.
HeghDI' HYPERLINK Qap ngaS 'e' cell qar SoH click, SoQmoHbogh ghaH hyperlink.
optional celltext parameter SoH yIlo', url Sam, 'ej vaj bIngDaq ghItlh leghlu' mI' pagh cha' formula.

hyperlinked cell SoQmoHbogh ghaH je keyboard, cell, wIv press f2 Edit mode, 'el porghlaHDaj in front of hyperlink cursor, Shift + f10 press je, vaj 'eb Hyperlink DawIvpu'.
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Peteron
Posts: 4
Joined: Thu Jun 29, 2017 8:30 pm

Re: Open File function

Post by Peteron »

Well aren't you the clever one!!!!!!!!!!!!!!!
Open Office v 4.1.3 running on Windows 10
User avatar
robleyd
Moderator
Posts: 5081
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Open File function

Post by robleyd »

You haven't said how you are having difficulty with the HYPERLINK function. In your case it seems it could be as simple as

Code: Select all

=HYPERLINK("file:///C:/full/path/to/image.png")
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Peteron
Posts: 4
Joined: Thu Jun 29, 2017 8:30 pm

Re: Open File function

Post by Peteron »

I have,following your advice managed to create the hyperlink and it works fine. I am still struggling with having that hyperlink in a cell as a "button". Otherwise the hyperlink runs into let's say 2 inches across the spreadsheet and looks terrible. Thanks for your help I am well on the way to doing what I am trying to do. Ta
Open Office v 4.1.3 running on Windows 10
User avatar
robleyd
Moderator
Posts: 5081
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: Open File function

Post by robleyd »

Then you may need to go to the next level of using the HYPERLINK function - utilise the second argument to replace the link itself with text of your choice.

So, utilising the guidance of F1 help, which shows the syntax as HYPERLINK("URL"; "CellText") we might use something like

Code: Select all

=HYPERLINK("file:///C:/a/really/long/path/to/the/picture/soomewhere/in/the/filesystem/image.png";"Short text")
This will display Short text in the cell rather than the URL.

This is much like the example shown in the help
=HYPERLINK("file:///C:/writer.odt#Specification";"Go to Writer bookmark")displays the text Go to Writer bookmark, loads the specified text document and jumps to bookmark "Specification".
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.2.2; SlackBuild for 24.2.2 by Eric Hameleers
Post Reply