followup tdf#122098 xlsx export: avoid corrupt format if not bool value

Although I can't find any documents that cause a "b"
when the value is not 1 or 0, if such should ever happen,
then Excel complains about an invalid format and fails to load.

(The formatting looks a bit weird, but that is what clang-format
produces. How nice.)

Change-Id: I090a27829596260cdd6379b6a6daa75ce250b7e0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/130734
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
This commit is contained in:
Justin Luth 2022-03-01 06:54:49 +02:00 committed by Justin Luth
parent 2c6f5ebfe6
commit 5a64b618d8

View file

@ -673,7 +673,10 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT
rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError));
break;
case sc::FormulaResultValue::Value:
rsType = rCell.GetFormatType() == SvNumFormatType::LOGICAL ? "b" : "n";
rsType = rCell.GetFormatType() == SvNumFormatType::LOGICAL
&& (aResValue.mfValue == 0.0 || aResValue.mfValue == 1.0)
? "b"
: "n";
rsValue = OUString::number(aResValue.mfValue);
break;
case sc::FormulaResultValue::String: