Bug 164895 - FILEOPEN: reference in named expression in xlsx format not recognized
Summary: FILEOPEN: reference in named expression in xlsx format not recognized
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.4.0.3 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:25.8.0 target:24.8.6 target:25...
Keywords: bibisected, bisected, regression
Depends on:
Blocks: Cell-Name
  Show dependency treegraph
 
Reported: 2025-01-28 17:25 UTC by petr.lump
Modified: 2025-03-01 13:12 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
The Inccorrectly interpreted XLSX (5.67 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2025-01-28 21:36 UTC, petr.lump
Details
Working ODS (9.62 KB, application/vnd.oasis.opendocument.spreadsheet)
2025-01-28 21:37 UTC, petr.lump
Details

Note You need to log in before you can comment on or make changes to this bug.
Description petr.lump 2025-01-28 17:25:11 UTC
Description:
Loading an xlsx document with named formulae lowercases column names which break some formulas.

Other software - a php library in my case - loads it as uppercase, so it must be saved properly. Does not matter if I am loading one saved from PHP or from Calc.

Works with the ODF format.

Steps to Reproduce:
1.Create a document

2.Create a named formual in global scope:
X -> =SUM(OFFSET($AJ$1;3;0;COUNTA($A:$A))
COUNTA($A:$A) = 5
SUM(OFFSET($AJ$1;3;0;COUNTA($A:$A)) = 100

3. Save file as XLSX
4. Load
5. Loads as 
X -> =SUM(OFFSET($aj$1;3;0;COUNTA($a:$a))
Which results in 
COUNTA($a:$a) = 0
SUM(OFFSET($AJ$1;3;0;COUNTA($A:$A)) = 0

Actual Results:
COUNTA($a:$a) = 0
SUM(OFFSET($aj$1;3;0;COUNTA($a:$a)) = 0

Expected Results:
COUNTA($A:$A) = 5
SUM(OFFSET($AJ$1;3;0;COUNTA($A:$A)) = 100


Reproducible: Always


User Profile Reset: Yes

Additional Info:
May just be easier to fix the COUNTA/ OFFSET/others so it does not break.
Comment 1 m_a_riosv 2025-01-28 21:16:36 UTC
Please attach a sample file, reduce the size as much as possible without private information, and paste the information in Menu/Help/About LibreOffice, there is a copy icon.
Comment 2 petr.lump 2025-01-28 21:36:51 UTC
Created attachment 198820 [details]
The Inccorrectly interpreted XLSX
Comment 3 petr.lump 2025-01-28 21:37:30 UTC
Created attachment 198821 [details]
Working ODS
Comment 4 petr.lump 2025-01-28 21:40:29 UTC
I added 2 functions only one of which seems to break in the end, not sure if I diagnosed it wrong the first time.  

Version info:

Version: 24.8.4.2 (X86_64) / LibreOffice Community
Build ID: bb3cfa12c7b1bf994ecc5649a80400d06cd71002
CPU threads: 8; OS: Windows 10 X86_64 (10.0 build 19045); UI render: Skia/Vulkan; VCL: win
Locale: cs-CZ (cs_CZ); UI: en-GB
Calc: CL threaded
Comment 5 m_a_riosv 2025-01-28 21:45:03 UTC
XLSX file opens bad with
Microsoft® Excel® para Microsoft 365 MSO (versión 2412 compilación 16.0.18324.20092) de 64 bits
Comment 6 raal 2025-02-12 22:40:49 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-7.3.
Adding Cc: to Eike Rathke ; Could you possibly take a look at this one?
Thanks
 a983c048ca8e67e1941435a31baa67bda1ff4fb8 is the first bad commit
commit a983c048ca8e67e1941435a31baa67bda1ff4fb8
Author: Jenkins Build User <tdf@pollux.tdf>
Date:   Tue Jun 7 19:35:04 2022 +0200

    source ea91f8f9b1bccce73a22af8b4c1626ccb834b9d1

135379: Resolves: tdf#148163 Preserve names of bad cell reference input again | https://gerrit.libreoffice.org/c/core/+/135379
Comment 7 Eike Rathke 2025-02-26 18:05:37 UTC
The lowercase column letters are just an effect of the reference not being recognized as valid during compilation of the named expression, to visually indicate a failure position. The reference not being recognized seems to happen during OOXML load. One can force a recompilation of a named expression in the Manage Names dialog by positioning the cursor in the "Range or formula expression" edit field and hit Enter, which then yields no error.
Comment 8 Commit Notification 2025-02-28 12:24:27 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/23a9d6f069039fb8032362e00fbe42dea4ffb125

Resolves: tdf#164895 Fix OOXML global names import without sheet reference

It will be available in 25.8.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 9 Eike Rathke 2025-02-28 12:26:35 UTC
Pending review
https://gerrit.libreoffice.org/c/core/+/182358 for 25-2
https://gerrit.libreoffice.org/c/core/+/182360 for 24-8
Comment 10 Commit Notification 2025-02-28 16:29:57 UTC
Xisco Fauli committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/820cd47b34a8138a2c17094ee4ae2ebbd9d507ab

tdf#164895: sc_subsequent_filters_test3: Add unittest

It will be available in 25.8.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 11 Commit Notification 2025-03-01 05:44:15 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/789de24ba79bfa0c95e1405f9a4c1fb052f67905

Resolves: tdf#164895 Fix OOXML global names import without sheet reference

It will be available in 24.8.6.

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 12 Commit Notification 2025-03-01 13:12:53 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/7ce206f88f04bdc422253c428a746adbaf5e16e8

Resolves: tdf#164895 Fix OOXML global names import without sheet reference

It will be available in 25.2.2.

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.