sc/source/filter/excel/xestream.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
New commits: commit 5a64b618d84edb65465950d54e3b4afc952a301c Author: Justin Luth <justin_l...@sil.org> AuthorDate: Tue Mar 1 06:54:49 2022 +0200 Commit: Justin Luth <jl...@mail.com> CommitDate: Tue Mar 1 07:19:51 2022 +0100 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 <jl...@mail.com> diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 2178b0b3abc7..08048e922111 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -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: