Bug 60647

Summary: FILESAVE: =CELL("filename") not updated
Product: LibreOffice Reporter: Mark Rogers <mark>
Component: SpreadsheetAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact: Joel Madero <jmadero.dev>
Severity: enhancement    
Priority: lowest CC: jmadero.dev, lange, mark, peter.scholtens_bugzilla
Version: 4.0.0.3 release   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Mark Rogers 2013-02-11 10:05:45 UTC
CELL("filename",..) should return the filename of the spreadsheet.

It does not update when the file is saved.

Steps to reproduce:
1. Create new spreadsheet.
2. Set A1 to =CELL("filename",A1). Cell reads "#$Sheet1
3. Save document.

Actual result:
A1 value does not change.

Expected result:
A1 should change to read 'file:///<filename with full path>'#$Sheet1

As far as I know this has never worked, it certainly didn't in 3.5.x, I just never got around to filing a bug report. Reporting now as my workaround has also broken in 4.0.x (bug #60645).

Tested on Windows and Linux.
Comment 1 Joel Madero 2013-03-21 14:21:07 UTC
well closing the document and then reopening it fixes the problem. I think this is more of an enhancement request than a bug as it's just not setup to "live update" and you are requesting this additional capability. With that being said:

I can confirm that this is a valid enhancement request on:
Version 4.1.0.0.alpha0+ (Build ID: 9a46e5614f5a0e0bdce3c497f81ca529da8fb5c)
Date:   Mon Mar 18 18:59:09 2013 +0100 
Platform: Bodhi Linux 2.2 x64
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
As I've been able to confirm the enhancement request I am marking as:

New (confirmed)
Enhancement
Lowest - very rare case that someone uses this particular function, plus very easy workaround of just closing document and reopening. Lastly, only impacts user one time (when file saved as new name) otherwise works fine.


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 
LibreOffice is powered by a team of volunteers, every bug is confirmed (triaged) by human beings who mostly give their time for free. We invite you to join our triaging by checking out this link:
https://wiki.documentfoundation.org/QA/BugTriage

There are also other ways to get involved including with marketing, UX, documentation, and of course developing -  http://www.libreoffice.org/get-help/mailing-lists/. 

Lastly, good bug reports help tremendously in making the process go smoother, please always provide reproducible steps (even if it seems easy) and attach any and all relevant material
Comment 2 Peter C. S. Scholtens 2014-10-05 12:51:43 UTC
In a comparable commercial product the same variable only gets updated after re-opening the file. In LO however, the variable is also updated in case a new sheet is created.

I assume that the re-evaluation of the cell value, which is triggered by opening a new sheet, could also be applied when saving it as a new file. However this may create a new problem: if this changed value is seen by LO as editing of data, the file will be again in the "edited/changed" state, requiring anothe save action.
Comment 3 Mark Rogers 2014-10-06 09:40:04 UTC
My argument would be that re-evaluation of this value should take place before saving. Ie the sequence for Save-As should be:
1. Obtain new filename from user, check for file collisions etc, open file handle for writing
2. Change name internally
3. Update any fields that need updating (document properties, =CELL("filename"), etc)
4. Write to disk with new filename

In doing so the refresh of the =CELL value is done immediately before the save and would not therefore trigger a changed state, and furthermore if the document is closed without further changes and re-opened in future then the stored value is correct without further work (although it should be refreshed in case the document has been renamed at the operating system level).

Of-course I have no idea how non-trivial that would be to code.

An alternative, which again might not be possible, would be that what is effectively just a cached value gets cleared/marked stale rather than updated, forcing a refresh when next used.

However, it does seem wrong that in effect I have a saved document that within it's saved content is a stored value that is always wrong unless a re-Save has occurred (rather than a Save-As or first Save from new).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.