Spreadsheet link to a file

Hi,

I’m looking for a way to create a link to a local file with the
spreadsheet gem. I can make a link to a site (see example below), but
what is the syntax for a file?

Thanks,

%%%%%
#!/usr/bin/env ruby
require ‘rubygems’
require ‘spreadsheet’

book = Spreadsheet::Workbook.new
sheet = book.create_worksheet
sheet[0,0] =
Spreadsheet::Link.new(url=‘http://www.google.fr’,fragment=“google”)
book.write ‘test.xls’
%%%%

use

Spreadsheet::Link.new(url=‘file:///path_to_file’)

This should create the link

HTH

Clive

Le Tue, 4 Aug 2009 08:47:37 -0500,
[email protected] a écrit :

Spreadsheet::Link.new(url=‘file:///path_to_file’)
This should create the link

it does… thanks!

Le Tue, 4 Aug 2009 08:47:37 -0500,
[email protected] a écrit :

Spreadsheet::Link.new(url=‘file:///path_to_file’)
This should create the link

it seems to only work for absolute path…
Spreadsheet::Link.new(url=‘file://./file’) does not work

what about relative one?

use

Spreadsheet::Link.new(url=‘file:///path_to_file’)

This should create the link

HTH

Clive

As far as I am aware, you can only use absolute paths with
file:///path_to_file as it is an address to a local file resource on
your system, same as http://path_to_resource points to an address
somewhere else in the world.

If you set up a hyperlink in Excel manually, and hover over it, you will
see that it will build the link as an absolute reference. If you try to
build it as a relative address, then the application can’t find the file
(I think).

Open to correction if somebody knows better.

Cheers