Bug 143192 - 'Format' Basic function doesn't handle Null values
Summary: 'Format' Basic function doesn't handle Null values
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected)
Hardware: All All
: medium normal
Assignee: Not Assigned
Depends on:
Reported: 2021-07-05 06:01 UTC by Mike Kaganski
Modified: 2022-03-26 00:27 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:
Regression By:


Note You need to log in before you can comment on or make changes to this bug.
Description Mike Kaganski 2021-07-05 06:01:25 UTC
Format function's format string takes up to four sections separated by semicolons. The fourth section is for Null values.

This is defined in SbxValue::Format, which handles SbxNULL values explicitly, calling SbxBasicFormater::BasicFormatNull. However, calling

> Format(Null)


> Format(Null, ";;;""NNN""")

results in "Inadmissible value or data type. Data type mismatch" error.
This works in VBA [1]: the former call returns "", and the latter returns "NNN".

[1] https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications
Comment 1 Andreas Heinisch 2021-07-07 17:59:32 UTC
Confirmed in:

Version: (x64) / LibreOffice Community
Build ID: 0aea0cee58fe77a9058217dfdfc3d6a02b29ee2a
CPU threads: 6; OS: Windows 10.0 Build 19042; UI render: Skia/Raster; VCL: win
Locale: en-US (de_DE); UI: en-US
Calc: CL
Comment 2 Paris Oplopoios 2022-03-25 17:17:22 UTC
I am trying to work on tdf#143193. Is Null supposed to be a correct data type? It doesn't seem to recognize it as one.