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

Open Office relative path vs. hard coded path
Goto page 1, 2  Next
 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Calc
View previous topic :: View next topic  
Author Message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Sun Jun 04, 2006 10:55 am    Post subject: Open Office relative path vs. hard coded path Reply with quote

I'm running debian etch, and OO 2.0.1

In moving OO documents from a Linux computer to an Apple laptop. I've
found something odd, when trying to link info among spreadsheets.

On the laptop, I can put the "relative" path, using "./" to get the
linking to work, yet n this Linux computer I have to specify the full
path to get the linking to work.

Yet, when I open the same documents in OO 1.1.3 things work as they are supposed to.

I always "assumed" that this was not necessary, but just using the "./"
would suffice. Am I wrong or am I missing something?

Thanks
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 11:52 am    Post subject: Reply with quote

How do you link informations?
Hyperlinks (could be buttons or text)
Hyperlink-formulas
URL-links (formulas having 'file://path/document.ods'#sheet1.A1)
DDE-links (formulas having DDE("soffice";"path/document.ods";"sheet1.A1")
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Sun Jun 04, 2006 11:54 am    Post subject: DDE linking Reply with quote

DDE-links (formulas having DDE("soffice";"path/document.ods";"sheet1.A1")

This is the way things are linked.

It works under Linx & MAC OS X with the 1.1.3/4 releases, but neither OS works with OO 2.0.*

Thanks
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 12:51 pm    Post subject: Reply with quote

My default template has this set of named formulas (Ctrl+F3)
cFilename: CELL("FILENAME")
=cFilename returnes 'file:///home/andreas/Documents/OOo/datatest.ods'#$Tabelle1 in current doc
FileURL: MID(cFilename;2;SEARCH("'#";cFilename)-2)
=FileURL returnes file:///home/andreas/Documents/OOo/datatest.ods in current doc (without the single quotes and without sheet name)
FileURLPath MID(cFilename;2;SEARCH("/[^/]+'#";cFilename)-1)
=FileURLPath returnes file:///home/andreas/Documents/OOo/ in current doc
After adding a new name
FilePath RIGHT(FileURLPath;LEN(FileURLPath)-7)
=FilePath returnes /home/andreas/Documents/OOo/ in current doc
=DDE("soffice";FilePath&"oooforum.ods";"max")
returnes the value of named cell max in file oooforum.ods in this file's directory.
On a windows system (backslash) you would use:
FilePath =SUBSTITUTE(RIGHT(FileURLPath;LEN(FileURLPath)-7);"/";"\")
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Sun Jun 04, 2006 1:24 pm    Post subject: this is what I have Reply with quote

This is what works under OO1.1.3;

=DDE("soffice";"./bar_receipts2006.sxc";"April.I39")

This does not work under OO 2.0.1
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 1:43 pm    Post subject: Re: this is what I have Reply with quote

Mailman42 wrote:
This is what works under OO1.1.3;

=DDE("soffice";"./bar_receipts2006.sxc";"April.I39")

This does not work under OO 2.0.1

I can't change it. I did not even know that it's possible with OOo1.
Just tried to provide a workaround that needs to be setup once and works with all kind of links in all versions by calculating the URL-path or the system-dependent path of current document.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Sun Jun 04, 2006 1:54 pm    Post subject: so? Reply with quote

I'm "stuck" using OO 1.1.* for the time being?
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 2:19 pm    Post subject: Reply with quote

Open your doc
Call Menu:Insert>Names>Define...
Name:cFilename
refers to: CELL("FILENAME")
Hit button "Add"
Name:FileURLPath
refers to: MID(cFilename;2;SEARCH("/[^/]+'#";cFilename)-1)
Hit button "Add"
Name: FilePath
refers to: RIGHT(FileURLPath;LEN(FileURLPath)-7)
Hit button OK

Test formula =FilePath with any cell.

If the cell returnes the right path:
Menu:Edit>Find/Replace
Find: DDE("soffice";"./
Replace: DDE("soffice";FilePath&"
If the cell does not return the right path post an example of your DDE-function

If you want to use this technique in other docs make a template with the defined names.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Sun Jun 04, 2006 2:57 pm    Post subject: You sort of lost me Reply with quote

Villeroy wrote:
Open your doc
Call Menu:Insert>Names>Define...
Name:cFilename
refers to: CELL("FILENAME")
Hit button "Add"


I have this done, Took me a minute to figure out exactly what you were referring to,

Below, you have me lost.

Villeroy wrote:

Name:FileURLPath
refers to: MID(cFilename;2;SEARCH("/[^/]+'#";cFilename)-1)
Hit button "Add"
Name: FilePath
refers to: RIGHT(FileURLPath;LEN(FileURLPath)-7)
Hit button OK

Test formula =FilePath with any cell.

If the cell returnes the right path:
Menu:Edit>Find/Replace
Find: DDE("soffice";"./
Replace: DDE("soffice";FilePath&"
If the cell does not return the right path post an example of your DDE-function

If you want to use this technique in other docs make a template with the defined names.


Not sure if it is menu -> insert-> names?
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 3:22 pm    Post subject: Reply with quote

After you have added the first named reference (name, formula, add-button) you can reuse the already opened dialog. Next name, next formula, add-button.
Add the other two names, confirm the dialog and test the named calculations by typing them as formulas into three cells:
=cFileName
=fileURLPath
=filePath

The third one (the one you want to use) is derived from the second one which could be used with other kinds of links. The second one is derived from the first one.
If you get the current document's path from the third formula then you may change your DDE-function by replacing the ./ with filePath and the filename.
"./Linked.ods" --> filePath&"Linked.ods".
I guess OSX uses slash as path-separator like any other unix system.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Sun Jun 04, 2006 4:56 pm    Post subject: I'm still not seeing it Reply with quote

In my version of OO 2.0.1, when I get to Insert -> Names -> Define or (CTRL -F3). I don't see a way to upload a screen capture;

DEFINE NAMES
NAME [__________________________} OKAY
CANCEL
HELP

ADD \ greyed out
DELETE/


I don't see anything on this OO 2.0.1 that has the formula.

Under 2.0.1, I can specify the full path, and that'll work;

=DDE("soffice";"/home/rodney/waste/test/some_file2006.sxc";"April.I39")

yet

=DDE("soffice";"/some_file2006.sxc";"April.I39")

does not.

I know I'm repeating, but I don't see the functions you are mentioning.
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 5:05 pm    Post subject: Reply with quote

Just type a name and what it refers to and you are allowd to add this named reference.
Then you can refer to this name in any formula.

If you can't get your named refs to work:
Code:

=DDE("soffice";RIGHT(MID(CELL("FILENAME");2;SEARCH("/[^/]+'#";CELL("FILENAME"))-1);LEN(MID(CELL("FILENAME");2;SEARCH("/[^/]+'#";CELL("FILENAME"))-1))-7)&"some_file2006.sxc";"April.I39")

does the same with one long concatenated formula.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10106
Location: Germany

PostPosted: Sun Jun 04, 2006 5:25 pm    Post subject: Reply with quote

Just another way to define your names:
Get an unused range, I would suggest a blank sheet.
First cell: =CELL("FILENAME")
In the name box -on the formula bar, left of the formula box- type: cFilename
Second cell: =MID(cFilename;2;SEARCH("/[^/]+'#";cFilename)-1)
Name box: FileURLPath
3rd cell: =RIGHT(FileURLPath;LEN(FileURLPath)-7)
Name box: FilePath

Now the three names refer to the three cells. You should hide or protect these cells in order to prevent accidental deleting or overwriting.
_________________
Rest in peace, oooforum.org
Get help on https://forum.openoffice.org
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Sun Jun 04, 2006 5:27 pm    Post subject: Reply with quote

Quote:
I don't see the functions you are mentioning.


Villeroy is suggesting you insert his formulas into your document, then give appropriate names to the cells containing the formulas. You can then use those cell names in your link formulas. It's a way of circumventing the requirement to include a full path in your DDE formulas.

I've run up against a similar problem trying to use ~/ in StarBasic.
_________________
search forum by month
Back to top
View user's profile Send private message
Mailman42
General User
General User


Joined: 20 Oct 2005
Posts: 11

PostPosted: Mon Jun 05, 2006 7:47 am    Post subject: after a nights rest Reply with quote

I did try to insert the formulas into a blank spreadsheet, keep getting "err: 502" messages.

I've changed "filename" to my spreadsheet name.

Tha's the best I can do right now.

Thanks to all
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 Calc All times are GMT - 8 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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