Bug 100297 - API, Calc sheets, Inconsistency concerning changes of cell properties by a user function.
Summary: API, Calc sheets, Inconsistency concerning changes of cell properties by a us...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
5.1.2.2 release
Hardware: All All
: low normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Macro
  Show dependency treegraph
 
Reported: 2016-06-09 17:40 UTC by Wolfgang Jäger
Modified: 2023-04-24 17:29 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Demonstration of the problems; Code included (21.28 KB, application/vnd.oasis.opendocument.spreadsheet)
2016-06-09 17:40 UTC, Wolfgang Jäger
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Jäger 2016-06-09 17:40:27 UTC
Created attachment 125577 [details]
Demonstration of the problems; Code included

Predecessors of LibO Calc did not allow any changes of the content of a cell by a function called from a formula contained in a cell of the same sheet. AOO 4.1.2 still is regarding this restriction (as I tested). 

LibO relieved this restriction substantially. From my recent tests I found that changes of all the relevant properties as there are 
- Value
- String
- Formula
for cells in the same sheet as the call of the function whose body is performing the changes are allowed. 
This with one exception: Setting the Formula property to "" (empty string) which should make the cell BLANK (answer TRUE if asked ISBLANK) does not cause an error, but is not performed. It only works for cells in different sheets. 

If the content of a cell in a different sheet is changed by the body of a function called from a cell not in the active sheet, the recalculation of a cell in the active sheet referencing the changed cell, is not correctly triggered. 

Generally the behaviour of cells is inconsistent with respect to changes of contents by the bodies of user functions via the API. 

The alternatives I see are to either suppress changes of cells by function bodies completely, or to thoroughly remove any inconsistencies. 

See attached example.
Comment 1 Buovjaga 2016-10-12 11:19:01 UTC
Tentatively setting to NEW and CC'ing Eike.
Comment 2 Wolfgang Jäger 2017-09-30 19:15:07 UTC
It is still unclear which properties of cells allow chagnes by SIDE-EFFECTs of user functions called during the evaluation of a formula IN THE SAME SHEET. 

The classical restriction was (and still is in AOO) that no changes at all are allowed. 

LibreOffice since V5.1 (at least) loosened this restriction: 
.String
.Value
.Formula e.g.
accept assignments, .Formula with the exception of new content "".

Other properties, in specific those containing hard attributes and the 
.CellStyle 
property refuse to accept an assignment. 

Above statements are made after testing with V5.4.1 and V5.4.2 today.

Is there any specification concerning this?
Comment 3 QA Administrators 2018-10-01 02:52:27 UTC Comment hidden (obsolete)
Comment 4 QA Administrators 2021-04-22 03:54:36 UTC Comment hidden (obsolete)
Comment 5 QA Administrators 2023-04-23 03:26:11 UTC Comment hidden (obsolete)
Comment 6 Eike Rathke 2023-04-24 17:29:23 UTC
(In reply to Wolfgang Jäger from comment #2)
> It is still unclear which properties of cells allow chagnes by SIDE-EFFECTs
> of user functions called during the evaluation of a formula IN THE SAME
> SHEET. 
> 
> The classical restriction was (and still is in AOO) that no changes at all
> are allowed. 
Best would be to go back to that behaviour.. least surprises.


> LibreOffice since V5.1 (at least) loosened this restriction: 
> .String
> .Value
> .Formula e.g.
> accept assignments, .Formula with the exception of new content "".
Which IMHO is *wrong*. Any modification to content while a calculation is running cries for undefined behaviour.

> Other properties, in specific those containing hard attributes and the 
> .CellStyle 
> property refuse to accept an assignment. 
Even those, with conditional formatting and the dreaded STYLE() function and CELL() obtaining formatting, can clash with calculations.

> Above statements are made after testing with V5.4.1 and V5.4.2 today.
> 
> Is there any specification concerning this?
No. It depends on implementation and actual spreadsheet content / formulas what could work and what not. The safe side is to not allow any modifications.

Even modifications on other sheets than the user defined function being called from aren't safe, they are just less likely to interfere with less inter-sheets references, and it is possible to build well behaving documents when knowing the implications.