Bug 62770 - FILEOPEN XLS file with conditional formats, sheet name gets inserted in conditional formula
Summary: FILEOPEN XLS file with conditional formats, sheet name gets inserted in condi...
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: Markus Mohrhard
URL:
Whiteboard: target:5.2.0
Keywords:
: 91868 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-03-26 16:06 UTC by Paul Kinzelman
Modified: 2016-10-25 19:08 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
short Excel test file (14.00 KB, application/vnd.ms-excel)
2013-12-14 16:27 UTC, Paul Kinzelman
Details
ODS/XLS tests created under v3304 and v4132 (15.94 KB, application/zip)
2013-12-14 23:44 UTC, Owen Genat (retired)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Kinzelman 2013-03-26 16:06:25 UTC
This sounds similar to bug 36379 from 2011, but it's still in the current release. My apologies in advance if this filing is a duplicate. In fact, I thought I already reported this 6 months ago and it was reported as fixed, but I can't find the bug now and it's still broken.

If I create a file in Excel 2000 with a conditional format for a cell like:
  Formula Is: =AND(OR(L6<$B6,E6<B6,L6<E6),COUNT(L6))

and if I import this file using Calc, what appears for the conditional format for that cell in Calc is:
AND(OR('2013'!L6<'2013'!$B6,'2013'!E6<'2013'!B6,'2013'!L6<'2013'!E6),COUNT('2013'!L6))

As you can see, each cell spec is prepended with the string:
          '2013'
which is the name of the sheet.

This will arithmetically work, but the formulas are polluted with unnecessary information. Formulas should not be changed from what was written in the source.

In addition, (perhaps this is unrelated, I don't know) when I save this file from calc, I get the dialog box:

Warning saving the document name-test:
Write Error.
All changes to the Basic Code are lost. The original VBA Macro Code is saved instead.

Then when I open it again with Excel 2000, I get a notice saying that my spreadsheet contains macros, do I want to enable them, when in fact, my spreadsheet should contain no macros. Where did they come from?

And when I look at the conditional format formula, it is polluted with the sheet name (as I saw in Calc).

Would it help to have a small example test case, or can you tell what's wrong from what I've written?
Comment 1 Owen Genat (retired) 2013-12-14 13:20:46 UTC
Paul can you please attach an example document created in Excel 200 with the required formula for others to test? Status set to NEEDINFO. Once an example is attached, please set the status back to UNCONFIRMED. Thanks.
Comment 2 Paul Kinzelman 2013-12-14 16:27:01 UTC
Created attachment 90774 [details]
short Excel test file
Comment 3 Paul Kinzelman 2013-12-14 16:31:28 UTC
I just posted a short Excel test file created in Excel 2000. Comments in the file show how it works.

When I read the file using 4.0.5.2 LibreOffice Spreadsheet, the conditional format formula at D4 comes out to:
(Sheet1!B4<>Sheet1!C4)

instead of the original (and still with Excel 2000):
=(B4<>C4)

Thanks for your work!
Comment 4 Owen Genat (retired) 2013-12-14 23:44:11 UTC
Created attachment 90790 [details]
ODS/XLS tests created under v3304 and v4132

Thanks for the test file Paul. I have opened it under Ubuntu 10.04 x86_64 running: 

- v3.3.0.4 OOO330m19 Build: 6
- v3.4.6.2 OOO340m1 Build: 602
- v3.5.7.2 Build ID: 3215f89-f603614-ab984f2-7348103-1225a5b
- v3.6.7.2 Build ID: e183d5b
- v4.0.6.2 Build ID: 2e2573268451a50806fcd60ae2d9fe01dd0ce24
- v4.1.3.2 Build ID: 70feb7d99726f064edab4605a8ab840c50ec57a

... and all versions display the indicated (Sheet1!B4<>Sheet1!C4) rather than the expected (B4<>C4) notation. I then created two similar ODS under v3.3.0.4 and v4.1.3.2 and saved these in XLS (Excel 97/2000/XP/2003) - refer attached. I included a basic formula as well as a formula in a conditional formatting context. Both XLS versions exhibit the same problem for the formula in the conditional format context i.e., the sheet name is added to the notation.
Comment 5 Owen Genat (retired) 2013-12-14 23:47:52 UTC
As per comment #4, confirmed. Status set to NEW. Component set to Spreadsheet. Version set to Inherited From OOo. Platform set to All/All.

Many thanks for the contribution Paul.
Comment 6 Paul Kinzelman 2013-12-14 23:50:48 UTC
(In reply to comment #5)
> As per comment #4, confirmed. Status set to NEW. Component set to
> Spreadsheet. Version set to Inherited From OOo. Platform set to All/All.
> 
> Many thanks for the contribution Paul.

I'm happy to help. I used to be in the biz so I know how valuable it is to have good and accurate customer/user feedback and short test files (as opposed to the uneducated and unhelpful comment of "nothing works" :-).
Comment 7 mitja 2014-10-14 07:27:15 UTC
The same issue still resides in LibreOffice 4.3.2.2.

Furthermore even worse is the issue when you save file back to XLS format with LibreOffice. The Format Condition gets corrupted in a way that the prependes sheet name (e.g. '2013' like example above) becomes $#REF!. , after you open such file again. This is definitely happening when you have a document with prepended sheet names in formulas of Format Condition, and save it to XLS. If you save such document to ODS format it is ok.
And this is very annoying as you formatting is corrupted.

Funny thing is that if you prepend the condition formula with absolute reference of sheet name (e.g. $2013.) then condition formula isn't corrupted after saving to XLS!
Comment 8 QA Administrators 2015-10-14 19:57:20 UTC Comment hidden (obsolete)
Comment 9 Buovjaga 2016-01-29 14:37:03 UTC
Still confirmed.

Win 7 Pro 64-bit Version: 5.2.0.0.alpha0+
Build ID: 259c1ed201f4277d74dfd600fed8c837cbf56abc
CPU Threads: 4; OS Version: Windows 6.1; UI Render: default; 
TinderBox: Win-x86@39, Branch:master, Time: 2016-01-27_00:45:12
Locale: fi-FI (fi_FI)
Comment 10 Commit Notification 2016-04-12 16:42:17 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

conditional format formulas don't support 3d refs in xls, tdf#62770

It will be available in 5.2.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 11 Commit Notification 2016-04-12 16:42:21 UTC
Markus Mohrhard committed a patch related to this issue.
It has been pushed to "master":

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

xls does not allow 3D refs in cond format formulas, tdf#62770

It will be available in 5.2.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 12 Markus Mohrhard 2016-04-21 16:30:20 UTC
*** Bug 91868 has been marked as a duplicate of this bug. ***