Bug 83779 - FILESAVE: Error in saving as Excel files - logical boolean type of FALSE and TRUE values not preserved during input
Summary: FILESAVE: Error in saving as Excel files - logical boolean type of FALSE and ...
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: Not Assigned
URL:
Whiteboard: BSA target:6.5.0
Keywords: filter:xlsx
Depends on:
Blocks: XLSX
  Show dependency treegraph
 
Reported: 2014-09-11 18:59 UTC by Marius Marsh
Modified: 2020-01-22 17:18 UTC (History)
4 users (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 Marius Marsh 2014-09-11 18:59:44 UTC
Problem description: 

Steps to reproduce:
1. Create a file with a functioning algorithm that includes IF(ISNUMBER(XX)=0  ( I note that LO calc will convert the word "FALSE" to 0 whether you type it in or it comes from an Excel file)
2.Save the file as an Excel file (.xls, .xlsx etc) 
3.Open the file in Excel (I tried it in Excel 2010, and 2007) 

Current behavior:
LO calc doesn't convert the 0 in IF(ISNUMBER(XX)=0 to "FALSE", and then Excel sees the 0 in IF(ISNUMBER(XX)=0 as the number 0.  All subsequent dependent algorithms are then in error (if cell (xx) isn't the number 0. 

Expected behavior:
 LO calc should convert the 0 to "FALSE".  Similarly, if the algoritm were IF(ISNUMBER(XX)=1, it should convert the 1 to "TRUE" (but, I am not sure why one would ever need to do the latter) 

              
Operating System: Windows 7
Version: 4.2.5.2 release
Comment 1 Eike Rathke 2014-09-11 21:39:58 UTC
Calc does not have a distinct boolean type, whereas Excel does and expects it and does not convert numeric type to boolean type. The expression IF(ISNUMBER(XX)=FALSE,...) or IF(ISNUMBER(XX)=0,...) can be rewritten as IF(ISNUMBER(XX)=FALSE(),...) or IF(NOT(ISNUMBER(XX)),...) so that both applications understand it.

It may be desirable to preserve input and imported FALSE and TRUE values by converting them to FALSE() and TRUE() functions.
Comment 2 QA Administrators 2015-10-14 19:56:08 UTC Comment hidden (obsolete)
Comment 3 Roman Kuznetsov 2019-03-02 18:38:11 UTC
Eike, may be it changed anything from 2014 year?
Comment 4 Mike Kaganski 2020-01-04 13:00:35 UTC
Can't we support also TRUE and FALSE *keywords* as synonyms for 1 and 0, and so import and export them as is? (But converting to functions is also an option, of course; just it wouldn't solve e.g. problems with formulas in CSV)...
Comment 6 Mike Kaganski 2020-01-05 10:00:20 UTC
https://gerrit.libreoffice.org/c/core/+/86235 is a proof-of-concept to allow using TRUE/FALSE without parens - just for Eike's review. Possibly going with TRUE/FALSE import as functions would be easier and safer - but wanted to explore this possibility first.
Comment 7 Mike Kaganski 2020-01-05 11:09:39 UTC
https://gerrit.libreoffice.org/c/core/+/86238 is a conservative approach importing TRUE/FALSE as TRUE()/FALSE().

(In reply to himajin100000 from comment #5)

himajin100000: thank you for the code pointer!
Comment 8 Commit Notification 2020-01-22 16:31:26 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/197aa7911d5be5464efd19feaf3370eea1c15ab1

tdf#83779: convert TRUE/FALSE constants to functions TRUE()/FALSE()

It will be available in 6.5.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.