Bug 66353 - DATALOSS: **Expression is faulty** in cells with formulas containing both references to this table and another table cells after paste to this table
Summary: DATALOSS: **Expression is faulty** in cells with formulas containing both ref...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: high major
Assignee: Mike Kaganski
URL:
Whiteboard: target:5.0.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-29 05:02 UTC by Mike Kaganski
Modified: 2015-05-11 12:31 UTC (History)
1 user (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 Mike Kaganski 2013-06-29 05:02:28 UTC
Steps to reproduce:

1. Create a new empty document.
2. Insert a table, say, 1x1 (dimensions don't matter) - Table 1.
3. Put a value in the first cell of Table 1 (A1), say, 1.
4. After the first table, add another table 1x3 (again, dimensions don't matter, but to show the problem, 3 or more cells required) - Table 2.
5. In the top cell of Table 2 (A1), write a value, say, 1.
6. In the second cell of Table 2 (A2), press F2, then click to the first cell of Table 2 (A1), type "+", then click to the first cell of Table 1 (A1). The resulting formula reads "=<A1>+<Table1.A1>". The result of the formula is 2.
7. Select first cell of Table 2. To do it, start selecting in A1, move mouse over A2, then return back to A1. This way, the cell A1 is selected, not the text inside it. This is important. Copy it to clipboard.
8. Put the caret to last cell of Table 2 (A3), and paste the copied cell.

Expected result:
The contents of first two cells of Table 2 must remain unchanged; the last cell should now contain number 1.

Actual result:
The second cell (A2) now shows **Expression is faulty**. Its formula now reads "=<A1>+<?>".

Impact:
This bug makes it almost impossible to productively work with several interconnected tables in a document; trying to paste several cells (say, a column) results in ruined formulas in all cells containing formulas with references both to cells of this table and cells of another table. If a formula contains only references to other table' cells, or only references to this table cells, this formula will stay intact. If in step 7 you copy only text, not the cell itself, everything will work without problems, but this is not feasible when there are many cells that must be copied this way. And if you intend to copy a formula that will update itself in the new place relative to neighbor cells, selecting the text of cell won't help, either. So, this bug prevents users from making professional quality work -> normal/medium.

Already present in 3.6.3.2; still present in 4.1.0.1.
Comment 1 Mike Kaganski 2013-06-29 14:50:26 UTC
I must add that when this bug happens, it cannot be undone, thus making it even more difficult to work. One have to either close without saving, thus loosing work since last save, or manually restore all the broken formulas.
Comment 2 Joel Madero 2013-06-29 20:05:00 UTC
Confirmed:
Windows 7
LibreOffice 4.0.4.2

New
Major - completely breaks formula use in multi-table setups if you copy/paste at all. Would be very bad in a professional document using multiple tables
High - despite this not getting a lot of attention yet - I think that the potential for major impact is quite high. Inserting tables is not uncommon and expecting that formulas are maintained when copy/paste occurs is expected


Thanks for the report!

--Most likely affects other operating systems also -- currently only tested on Windows, if I get some time I'll test in Linux also and mark as ALL
Comment 3 Mike Kaganski 2014-01-24 02:40:59 UTC
Already reproducible with OOO 3.3.0.
Also reproducible under Ubuntu 13.10 x64 with 4.1.4.2.
Still reproducible with 4.2.0.3.

Additional detail: this problem is dependent on order of operands in the formula. In steps from comment 0, if the formula will be "=<Table1.A1>+<A1>" instead of "=<A1>+<Table1.A1>", the bug will not appear.
Comment 4 Joel Madero 2015-05-02 15:43:18 UTC
** Please read this message in its entirety before responding **

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

   Test to see if the bug is still present on a currently supported version of LibreOffice (4.4.2 or later)
   https://www.libreoffice.org/download/

   If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior
 
 If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System

Please DO NOT

   Update the version field
   Reply via email (please reply directly on the bug tracker)
   Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3)

http://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword


Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa

Thank you for your help!

-- The LibreOffice QA Team This NEW Message was generated on: 2015-05-02
Comment 5 Mike Kaganski 2015-05-02 17:46:15 UTC
Still reproducible with Version: 4.4.3.2
Build ID: 88805f81e9fe61362df02b9941de8e38a9b5fd16
Locale: ru_RU
under Win7x64
Comment 6 Mike Kaganski 2015-05-08 14:20:25 UTC
Submitted patch to gerrit: https://gerrit.libreoffice.org/15678
Comment 7 Commit Notification 2015-05-10 20:00:04 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=4f864949a9484bbf21911859398743bfe2b1430f

tdf#66353: fix converting relative sw table formula back to box

It will be available in 5.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 8 Caolán McNamara 2015-05-10 20:00:37 UTC
This is obscure enough that it really needs a regression test
Comment 9 Commit Notification 2015-05-11 12:31:47 UTC
Caolán McNamara committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3fa5ac20a003d2eb0b718a98eb2217749e3133da

Related: tdf#66353 make a basic regression test for formula parser

It will be available in 5.0.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.