Bug 163554 - Error when reading an OOXML / Excel A1 notation 3D sheet range starting with a single-quoted sheet name, or badly writing a 3D sheet range containing a single-quoted sheet name.
Summary: Error when reading an OOXML / Excel A1 notation 3D sheet range starting with ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:25.2.0 target:24.8.4
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-21 12:58 UTC by Eric Wilson
Modified: 2024-10-24 17:21 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
test_stored_as_xlsx (8.84 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2024-10-21 13:38 UTC, Werner Tietz
Details
An Excel document with sheet names Sheel'1 and Sheet'2, and a cuboid formula (9.11 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2024-10-21 18:10 UTC, Mike Kaganski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Wilson 2024-10-21 12:58:22 UTC
Description:
Sum formula changes across multiple tabs after saving to xlsx format.

Steps to Reproduce:
1.Create a function that sums a cell across tabs
2.Save spreadsheet as xlsx type file (not an issue if saving as an ODS file)
3.Reopened in CALC - formula changed - 
Also opened in MS EXCEL and formula was incorrect.

Actual Results:
In my case, cell formula changed from:
=SUM('Time (PN8181)'.F11:$'Time (Misc) - Last'.F11)
to:
=SUM('time (pn8181)':$'Time (Misc) - Last'.F11:F11)
Sum shows as "0" - Does not show error even though formula is incorrect, unless cell edited.

Expected Results:
No formula change


Reproducible: Always


User Profile Reset: No

Additional Info:
I upgraded to this version. Bug was same on V24.4.x.x version as well.

I have a copy of the spreadsheet if needed.
Comment 1 Werner Tietz 2024-10-21 13:30:21 UTC
repro with:
____________________________________
Version: 24.8.2.1 (AARCH64) / LibreOffice Community
Build ID: 0f794b6e29741098670a3b95d60478a65d05ef13
CPU threads: 4; OS: Linux 6.6; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.UTF-8); UI: de-DE
Flatpak
Calc: threaded
______________________________________
Comment 2 Werner Tietz 2024-10-21 13:38:49 UTC
Created attachment 197176 [details]
test_stored_as_xlsx
Comment 3 Eike Rathke 2024-10-21 15:09:49 UTC
The exported formula in OOXML is
SUM('time (pnrst)':'time (misc) - last'!A1:A1)
and as such should be correct, would be
=SUM('time (pnrst)':'time (misc) - last'!A1:A1)
in Excel A1 notation, but is parsed back badly. Same if Formula syntax is switched to Excel A1.


(In reply to Eric Wilson from comment #0)
> Also opened in MS EXCEL and formula was incorrect.
What does Excel do with it?


> Sum shows as "0" - Does not show error even though formula is incorrect,
> unless cell edited.
For me the correct sums are displayed when opening the attached document. That is because results are not recalculated when opening .xlsx unless forced under Tools -> Options -> Calc -> Formula, after recalculation the #NAME? error is displayed.


It works if the sheets are renamed to time1 and time2 so the single quotes aren't needed and the expression is =SUM(time1:time2!A1:A1)
Comment 4 Eike Rathke 2024-10-21 16:05:18 UTC
A quoted sheet name in a range of sheets in Excel notation apparently never worked.
Comment 5 Eike Rathke 2024-10-21 17:21:33 UTC
(In reply to Eike Rathke from comment #3)
> (In reply to Eric Wilson from comment #0)
> > Also opened in MS EXCEL and formula was incorrect.
> What does Excel do with it?
It could be that Excel expects
=SUM('time (pn8181):Time (Misc) - Last'!F11)

Note the sick construct of concatenation of sheet names with : but the entire concatenation surrounded by single quotes, which only works because Excel does not allow : in sheet names. Otherwise it would be one quoted sheet name. Excel as ugly as only Excel can.
Comment 6 Mike Kaganski 2024-10-21 18:10:17 UTC
Created attachment 197184 [details]
An Excel document with sheet names Sheel'1 and Sheet'2, and a cuboid formula
Comment 7 Commit Notification 2024-10-24 10:12:59 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/472f17d203207f1ef9d75ecfc9facda2d5f43384

Resolves: tdf#163554 Read/write Excel 3D reference as 'Sheet1:Sheet2'!C4

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 8 Eike Rathke 2024-10-24 10:16:30 UTC
Pending review https://gerrit.libreoffice.org/c/core/+/175495 for 24-8
Comment 9 Eike Rathke 2024-10-24 14:12:02 UTC
Seems the Commit Notification bot is dysfunctional at the moment, that has been pushed to libreoffice-24-8, thanks Xisco.

https://git.libreoffice.org/core/commit/b3adc88a5b73125bb6dd7f2ccb76ff6a382efd2e

It will be available in 24.8.4.
Comment 10 Commit Notification 2024-10-24 17:21:50 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/d8f71364a582e39a2fb04a09c9ae1bf8470c43c4

tdf#163554: sc_subsequent_export_test4: Add unittest

It will be available in 25.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.