Bug 143943 - [FILEOPEN] XLSB booleans interpreted as numeric formulae
Summary: [FILEOPEN] XLSB booleans interpreted as numeric formulae
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.3.0.0 alpha0+
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-18 19:17 UTC by SheetJS
Modified: 2021-08-19 17:41 UTC (History)
0 users

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 SheetJS 2021-08-18 19:17:27 UTC
Description:
LibreOffice translates both `BrtCellBool` (record type 4) as well as `BrtShortBool` (record type 15) to numeric expressions.

Steps to Reproduce:
download and open https://github.com/SheetJS/notes/raw/main/xlsb_short_records/brt_sst.xlsb

Actual Results:
cell A4 is 1 (formula expression `=TRUE()`)
cell B4 is 0 (formula expression `=FALSE()`)

Expected Results:
Cell A4 is `TRUE` (the value TRUE)
Cell A4 is `FALSE` (the value FALSE)


Reproducible: Always


User Profile Reset: Yes



Additional Info:
XLSB differentiates the literal true (record type 4 `BrtCellBool`) from the formula =TRUE() (record type 10 `BrtFmlaBool`)
Comment 1 [REDACTED] 2021-08-19 10:31:15 UTC
- TRUE and 1 are the same thing 
- FALSE and 0 are the same thing

Just format your cells using "Format Code" BOOLEAN.

From my perspective not a bug, but feel free to re-open, if you don't agree.
Comment 2 [REDACTED] 2021-08-19 10:38:20 UTC
See also: Open Document Format for Office Applications (OpenDocument) Version 1.3. Part 4: Recalculated Formula (OpenFormula) Format - 4.5 Logical (Boolean) https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1017898_715980110
Comment 3 SheetJS 2021-08-19 17:41:02 UTC
To be clear, 1 / TRUE / =TRUE() are not the same thing.

Consider the sample file.  Cell A3 is 1 and cell A4 is the boolean TRUE

Do a small check in Excel:

Set the cell D3 to the formula `=TYPE(A3)` and it returns 1 since A3 is a number.

Set the cell D4 to the formula `=TYPE(A4)` and it returns 4 since A4 is a boolean.


Do the same thing in LibreOffice:

Set the cell D3 to the formula `=TYPE(A3)` and it returns 1 since A3 is a number

Set the cell D4 to the formula `=TYPE(A4)` and it returns 8.  It returns 8 because, according to the docs, "8 = formula".


LibreOffice does have a fundamental understanding of booleans, as evidenced by the following sequence: set cell A7 to TRUE (just type TRUE in the formula bar and hit Enter) then set D7 =TYPE(A7) .  That will return 4.

As for the suggested workaround, it has no bearing on TYPE.  Using the "Boolean Value" number format does not change the cell type.