How to view 'full path' of open document?

From File menu take Properties and then the General tab.

> From File menu take Properties and then the General tab.

Thanks. That’s rather indirect, though. I was hoping for something that could be made to automatically display the path (i.e., as a ‘preference’).

The menu/keyboard shortcut does make this a bit easier: Alt + F, I (Although, if you’ve previously left the Properties window on a different tab then you’ll still need to navigate back to the “General” tab.)

There is another possibility that was tried under Linux.
The ‘File Explorer’ (Files) is opened and a ‘Libre Office’ document is opened.
If a document is dragged from the ‘File Explorer’ into the ‘Libre Office’ document then LO opens a new ‘Insert Section’ and it is possible to find the path of the document into the ‘File name’ field.

Hello everybody,

I know this is an old topic but I think my work can inspire and help others.

I searched a convenient way to display the full location of the current document in the titlebar and I found this thread (among several others) BUT I had not found my happiness which meets my need…

I spent many hours to search, test and I found an acceptable solution which fit to my needs which manage both local and network documents access (I have a NAS and many documents on it).

The solution uses LibreOffice macros written in Basic and the “on_DocLoad” code is triggered by the “Open Document” event.

To install it, just copy/paste “as is” the Github code in a macro module (welcome to use the default Module1 module or to add yours), and connect the “Open Document” event to the “on_DocLoad” code of the module … and “That’s all Folks!” :slight_smile:

Nota : for connect an event to a module’s code see here

Code : libreoffice_current_location_in_titlebar/macro.md at master · lenainjaune/libreoffice_current_location_in_titlebar · GitHub

Disclaimer : this code is suited for Linux ; you are welcome to modify it to fit for Windows or …

See you soon

lnj

@lenainjaune,

In at least some modules (and probably all but did not verify) there is an easier method to get the location rather than Shell & files:

ThisComponent.Location

Then you can use existing routines in the Tools library. See → [Calc] How to reference document name in macro?

:slight_smile:

Hello,

My LO version : 6.2.6.2

“ThisComponent.Location” or “ThisComponent.getLocation()” (which give the same thing) doesn’t work in my cases…

For a file named “with space and accentué.odt” (I am french :slight_smile: ) in a folder named “with space” it gives for :

local : file:///home/user/Documents/with%20space/with%20space%20and%20accentu%C3%A9.odt and for
smb share : smb://NAS.local/test/with%20space/with%20space%20and%20accentu%C3%A9.odt

So I tried to find a way to natively convert URL to give a location more readable but I found nothing … so I had no other choice to accomplish this that to implement a 3rd party solution.

But I always search a native solution…

You can probably guess why I never use spaces in my file or directory names – lots of hyphens and occasional under-scores, but never spaces.

Spaces in directories, file name, database table names and fields and so much more - leads to many complications.

A new answer for an old question:
This solution does not present the path in the title bar but, it is simple and does so in a cell. The formula is:

=CELL(“filename”).

In many of my spread sheets, for conveninence, I place this formula in one of the top left cells.

The question was tagged writer.
In a TextDocument you might use a textfield supporting the relevant service com.sun.star.text.textfield.FileName and having set the value 0 for the attribute FileFormat.
I doubt if many users woul like to have it on every page.
Showing the FilePath in the title bar of the document’s window might be preferable, and can work for every kind of document in the same way.