Bug 160466 - Allow Calc to temporarily edit data into a read-only document [RFE]
Summary: Allow Calc to temporarily edit data into a read-only document [RFE]
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.5.2 release
Hardware: x86-64 (AMD64) All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: needsDevAdvice
Depends on:
Blocks: Cell-Sheet-Protection Calc-UX Read-Only
  Show dependency treegraph
 
Reported: 2024-04-01 18:36 UTC by oeuceda
Modified: 2024-08-15 08:40 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oeuceda 2024-04-01 18:36:36 UTC
Description:
There is a spreadsheet I use that contains various calculators I occasionally need. This is a co-worker's document that I do not want to prevent him from using (nor do I want to accidentally save any changes) so I open it as a read-only file and use its calculators. The problem is, when Calc opens a file in read-only mode it does not allow you to enter data in any cells.

I think a better way to handle this (even if this is an option in Calc's preferences) is to allow entry of data but if the user tries to save the file, force them to save it as a different filename. This is how Excel does it, and it allows User-1's multi-function spreadsheet to be used by multiple people without having to worry about dumb User-4 saving changes and causing problems for all other users.

Keywords: EDITING, FILEOPEN, FILESAVE

Steps to Reproduce:
1. Open a file in read-only mode.
2. Try entering data into a cell.

Actual Results:
All text entry is blocked.

Expected Results:
Text entry is allowed, but cannot save over original file.


Reproducible: Always


User Profile Reset: Yes

Additional Info:
Please allow entry of data so multiple users are able to utilize a spreadsheet without unintentionally breaking it.
Comment 1 m_a_riosv 2024-04-02 01:45:32 UTC
Menu/Data/Edit mode [Ctrl+Shift+M]
And remember do not save the file.
Comment 2 Roman Kuznetsov 2024-08-05 10:59:32 UTC
And Calc shouldn't allow you to edit read-only file. All is correct

IMHO => WONTFIX
Comment 3 Heiko Tietze 2024-08-05 11:26:17 UTC
Not only Edit > Edit Mode allows to modify read-only documents but also the "Edit Document" button at the infobar. And you cannot overwrite r/o files anyway. 

If you mean Tools > Protect, if not secured with a password you can disable it.

So what exactly is not working? Or how do you make the document read-only?
Comment 4 ady 2024-08-05 11:52:29 UTC
(In reply to Roman Kuznetsov from comment #2)
> And Calc shouldn't allow you to edit read-only file. All is correct

FWIW, "Protection" is not the same as "Read-Only".

Comment 3 also mentions the difference, and possible methods to achieve the desired edition (which is not the same as actually saving the file).

Probably we need some clarification from the OP.
Comment 5 oeuceda 2024-08-05 16:17:48 UTC
Hello, everyone. I'll try to clarify how this spreadsheet is used and the issue I ran into here. :)

My colleague's file itself is not read-only because he works out of this document all day. I use a shortcut that opens it as read-only. This can be accomplished (in Windows) by using a shortcut where the Target field is   "C:\[Libre Calc path]\scalc.exe" /r "X:\[Document path]\document.xlsx" .

There are two reasons I open it read-only. The first is, obviously, I don't want to accidentally save whatever changes I make. The second reason is if a document is being opened as read-only, Calc (or any program) should not be locking the file to prevent other users from opening it. 


The problem I ran into that isn't allowing me to use Calc:

When Calc opens a file in read-only mode, it does not allow entry in any of the cells. I know it's a read-only file so I understand the idea here but this seems unnecessarily strict since the changes couldn't be saved anyway. It prevents my use of the calculators in this file.


The menu Edit -> Cell Edit Mode [F2] looked promising since it places a blinking text cursor in the cell but still doesn't allow text entry. I'll be happy to try any menu options that I have overlooked, and to give more detail as requested.

Thanks!

-Oz
Comment 6 ady 2024-08-05 16:55:24 UTC
FWIW, to me the request makes sense.

Indeed, Cell Edit Mode does not actually allow edition of a cell while the file is Read-only.

I am very tempted to set this RFE to new, although the request might sound somewhat controversial in some sense.

IDK whether it is possible to allow actual edition while not allowing to save.

I guess that the workaround would be to open the file (as read-only) and save as a new file (i.e. different name), in order to be able to edit it. But, the workaround has negative consequences and wastes users' resources, adding some degree of file management; the request in this ticket would avoid them.
Comment 7 oeuceda 2024-08-05 21:12:26 UTC
Thanks, ady, I'm glad it makes sense to someone other than me. :)

This is how Excel treats read-only files, for example. You can edit the spreadsheet as you normally would but if you try to save the changes then Excel reminds you the document is read-only and prompts you to save it as a different filename. This gives you the option to keep your changes, or an opportunity to say "Oops, I'm glad this is read-only because I didn't mean to hit CTRL+S!" :D

I realize this is an uncommon use but I feel like there isn't any downside for Calc to behave in the same way. That said, I'm no programmer so I have no idea difficult of a change this could be. :)

Thanks.

-Oz
Comment 8 Heiko Tietze 2024-08-06 06:01:27 UTC
The command line parameter /r has no effect for me. Changing the file attribute to read-only makes Excel behave exactly the same as LibreOffice and you get some infobar that allows to edit the file anyway (but you cannot overwrite then, of course).

Maybe you can change your script and set the attribute before starting LibreOffice, and when done you remove the r/o flag.
Comment 9 ady 2024-08-06 09:37:33 UTC
(In reply to Heiko Tietze from comment #8)
> The command line parameter /r has no effect for me

The specific command is only an anecdote. For this request, the way the file is set to read/only is not relevant.


> 
> Maybe you can change your script and set the attribute before starting
> LibreOffice, and when done you remove the r/o flag.

Why the OP would be interested in removing the r/o flag? That is exactly what the OP does not want to do, ever for this file.

In my system, LO is _not_ behaving like Excel. IIRC, Excel allows edition but warns about saving when it is working in r/o mode (and please correct me if I am remembering incorrectly). LO does not allow edition in r/o mode.

STR:

1. New Calc workbook.
2. Save with some name.
3. Menu Edit > "Edit Mode" (not to be confused with "Cell Edit Mode").
3.1. Note that, in the upper title bar, Calc added "(read-only)" to the name of the file.
4. Attempt inserting some value in some cell; you might try, but no edition is actually allowed.

Actual result:
Under this Mode, the file cannot be edited. So, blocking _Edit_ and blocking _Save_ are ATM one and the same status.

Request:
Have two separate statuses, in which you are still allowed to Edit (as long as Protection also allows it), even when you are not allowed to Save (with the same "path/name.type" file). "Save As" a different "path/name.type" is allowed.
When blocking the possibility to Save (i.e. r/o mode), and the user anyway attempts to save the editions that were made (the latter being something that is currently not possible to do), the result could be to suggest saving as a different (path/name.type) file.

IOW, allow to Edit (always according to Protection rules already established in the specific file) even when the file is set to r/o.


Use-case:
I want to always open the very latest version of a file that is always in a permanent edition/update status by some colleague, and perform some editions that are relevant for me but not for others (e.g. What-If, Solver...), but I never want to overwrite my edition onto the original file I opened. I want to be able to perform changes and read the results, but I never want to overwrite the original file.

IOW, the file works similarly to a template (which happens to be in some "continuous" update by someone else), never to be overwritten by me.

The current alternative is to open the file as r/o, then first of all save as a different file, allow Edit Mode and perform editions. Once I finish my work with the new file (that do not need to be saved), close it and delete the file. When I need the procedure again, repeat the alternative whole procedure, saving a new file each time, which I have to delete every time.

Hopefully this clarifies the focus of the request.
Comment 10 Heiko Tietze 2024-08-13 07:09:13 UTC
You are right, Excel opens the r/o file with just subtle information on the status. We indicate it clearly with an infobar that offers the interaction to "Edit Document". Saving over a r/o file is not possible in both applications, of course. I believe our workflow is better. At least there is no surprise when saving some modification is not possible on a completely r/o system.

(In reply to oeuceda from comment #0)
> I think a better way to handle this (even if this is an option in Calc's
> preferences) is to allow entry of data...
This makes me wonder if the OP is aware of the infobar and the Edit Mode option. Missing also a version.
Comment 11 oeuceda 2024-08-13 15:09:04 UTC
(In reply to Heiko Tietze from comment #10)
> You are right, Excel opens the r/o file with just subtle information on the
> status. We indicate it clearly with an infobar that offers the interaction
> to "Edit Document". Saving over a r/o file is not possible in both
> applications, of course. I believe our workflow is better. At least there is
> no surprise when saving some modification is not possible on a completely
> r/o system.
> 
> (In reply to oeuceda from comment #0)
> > I think a better way to handle this (even if this is an option in Calc's
> > preferences) is to allow entry of data...
> This makes me wonder if the OP is aware of the infobar and the Edit Mode
> option. Missing also a version.


Hello, Heiko.


I would argue Excel's workflow is better. The surprise (if any) of not being able to save alterations is immediately resolved by being offered to 'Save As' a different filename.

Edit Mode would defeat the purpose of how I'm trying to use this file. I don't want to change it away from read-only as there are two reasons I'm opening this file R/O:

1. The changes I make to the file are always temporary and must never be saved. Changing the Edit Mode would allow the file to be saved.
2. I'm trying to prevent Calc from locking this file and preventing other users from editing it. When Excel opens a spreadsheet in R/O it does not place locks on the file. This is how a program should behave as there's no need to lock a file that will not be edited. (see Calc bugs 137793 and 141909)

Unfortunately, Calc does neither of these things at this time so I am unable to use it. :(

Calc version: Originally 7.6.5.2, updated to 24.2.5.2.
Comment 12 ady 2024-08-13 17:13:05 UTC
My impression is that Heiko is focusing on the info bar (or whichever possible way of informing the user about the r/o status), rather than on the actual request.

Even if the separation between allowing _edit_ from allowing _save_ (i.e. the request) were to be implemented in Calc, it would generate some difficulties for older spreadsheets and users, with the current behavior being both actions either allowed or blocked as one.

For example, a user that already knows the current effect of allowing the current Edit Mode, would be surprised if the editions would not be allowed when trying to save. Such user would understandably be concerned, especially when the initial reaction could be "hey, I am loosing my changes; why cannot I save my work! Calc is failing!". As in this request, “Save as” would work around the temporal issue, giving time to be aware of the introduced change (somehow!?).

In order to avoid such potential conflicts (whether by users, or in older spreadsheets saved with older versions, before this request would be available in newer versions and in newer spreadsheets), the current "Edit Mode" would need to keep its current behavior, and, instead of replacing it, a pair of new Modes would have to be introduced (one for edition, another for saving). Moreover, such new Modes would have to be considered in other situations, such as for Protection options.

IOW, at first glance, introducing this request might not be so straight forward.


@oeuceda,

(Note: I never tried the following procedure myself, so it might not work at all as I describe it here.)

Until some relevant developer takes this request for implementation (if ever), I would suggest an alternative procedure. The original spreadsheet file (edited by your colleague) could be turned into a template. Your colleague would still work on the template itself, and save the file as such – a daily backup would be recommended. You would open the newest template as a common spreadsheet file (similar to opening the default template as "Untitled 1", which is never overwritten when saving as a normal spreadsheet file).

I don't know whether this procedure would actually work for your situation, constraints and needs. YMMV.
Comment 13 oeuceda 2024-08-13 18:09:18 UTC
Thank you, ady, I appreciate your input. I understand how different behavior could confuse long-time users. If this was implemented, perhaps it could be a setting toggled in the Tools->Options->Load/Save->General menu? That way Calc would remain familiar to those who have been using it for years but there would be the option for it to treat read-only files as Excel does for the Office users coming over to Calc.

I know my request is outside the norm so it's, *at best*, a very low priority but more likely not going to be added. And that's ok. There are bigger fish to fry, as they say. :)

I also appreciate your offer of a solution with the template idea. It's possible that would work however I don't want to try to force my colleague to change his workflow and how he operates merely to accommodate me. I'm going to great lengths to not interfere with his use of his files so I will simply return to using Excel as I have been.

What inspired me to try Calc here at work (I already use it at home), was my main spreadsheet is packed with VBA and gets twitchy when I have other spreadsheets open at the same time. My goal was to continue using Excel for my primary spreadsheet (which is incompatible with Calc) and use Calc for all the others. Unfortunately Calc's behavior with R/O files prevents that.


Thank you all for your interest! I'll continue monitoring this thread and will supply information as needed, however I no longer feel the need to push this boulder uphill for a solution. :)
Comment 14 Heiko Tietze 2024-08-14 06:47:58 UTC
While the requested "always open in edit mode" is easy to implement UI-wise (eg. to keep with a checkbox "[ ] Always open in edit mode" in the infobar, plus an accompanying setting under tools > options; or just an expert option AskForEditMode or the like), I still think that read-only is an attribute of the OS/DE and users should prefer other workflows.

Besides the mentioned template that could be the sheet protection (which I can imagine to be more flexible, bug 158724).

Anyway, lets see if the request finds more supporter or volunteer to implement.

=> NEW as of two opinions agreeing with the idea
Comment 15 ady 2024-08-14 12:24:20 UTC
(In reply to Heiko Tietze from comment #14)
> While the requested "always open in edit mode"

That is not the request in this ticket.

As for cell and worksheet Protection that you mention in comment 14, that is only a tangential issue, to be considered too (as mentioned in prior comments in this same tdf#160466), but it is also not the main request here.

Maybe this ticket needs some additional expert devs comments / opinions (e.g. whether the request is at least achievable in some way or another, with possible unwanted effects, or whether there is some alternative method).