diff options
-rw-r--r-- | sc/qa/unit/pivottable_filters_test.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/excel/xestream.cxx | 5 | ||||
-rw-r--r-- | sc/source/filter/oox/formulabuffer.cxx | 7 |
3 files changed, 14 insertions, 3 deletions
diff --git a/sc/qa/unit/pivottable_filters_test.cxx b/sc/qa/unit/pivottable_filters_test.cxx index 8ad8fbffee81..80557c5b12aa 100644 --- a/sc/qa/unit/pivottable_filters_test.cxx +++ b/sc/qa/unit/pivottable_filters_test.cxx @@ -2201,6 +2201,7 @@ void ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX() ScDocument& rDoc = xDocSh->GetDocument(); ScDPCollection* pDPs = rDoc.GetDPCollection(); CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), pDPs->GetCount()); + CPPUNIT_ASSERT_EQUAL(OUString("TRUE"), rDoc.GetString(ScAddress(0, 1, 0))); //A2 // Reload and check filtering of row dimensions xDocSh = saveAndReload(&(*xDocSh), FORMAT_XLSX); @@ -2218,11 +2219,11 @@ void ScPivotTableFiltersTest::testPivotTableBoolFieldFilterXLSX() const ScDPSaveDimension::MemberList& rMembers = pSaveDim->GetMembers(); CPPUNIT_ASSERT_EQUAL(size_t(2), rMembers.size()); - ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("0"); + ScDPSaveMember* pMember = pSaveDim->GetExistingMemberByName("FALSE"); CPPUNIT_ASSERT(pMember); CPPUNIT_ASSERT(pMember->HasIsVisible()); CPPUNIT_ASSERT(!pMember->GetIsVisible()); - pMember = pSaveDim->GetExistingMemberByName("1"); + pMember = pSaveDim->GetExistingMemberByName("TRUE"); CPPUNIT_ASSERT(pMember); CPPUNIT_ASSERT(pMember->HasIsVisible()); CPPUNIT_ASSERT(pMember->GetIsVisible()); diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 17395145bbab..3b49c5d6b9e2 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -670,7 +670,10 @@ void XclXmlUtils::GetFormulaTypeAndValue( ScFormulaCell& rCell, const char*& rsT rsValue = ToOUString(lcl_GetErrorString(aResValue.mnError)); break; case sc::FormulaResultValue::Value: - rsType = "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: diff --git a/sc/source/filter/oox/formulabuffer.cxx b/sc/source/filter/oox/formulabuffer.cxx index 2aeccb1b37b7..7fcc4f5e259f 100644 --- a/sc/source/filter/oox/formulabuffer.cxx +++ b/sc/source/filter/oox/formulabuffer.cxx @@ -153,6 +153,9 @@ void applySharedFormulas( pCell = new ScFormulaCell(rDoc.getDoc(), aPos, *pArray); rDoc.setFormulaCell(aPos, pCell); + if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0) + pCell->SetNeedNumberFormat(true); + if (rDesc.maCellValue.isEmpty()) { // No cached cell value. Mark it for re-calculation. @@ -227,6 +230,8 @@ void applyCellFormulas( pCell = new ScFormulaCell(rDoc.getDoc(), aPos, p->mpCell->GetCode()->Clone()); rDoc.setFormulaCell(aPos, pCell); + if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0) + pCell->SetNeedNumberFormat(true); // Update the cache. p->mnRow = aPos.Row(); @@ -245,6 +250,8 @@ void applyCellFormulas( ScFormulaCell* pCell = new ScFormulaCell(rDoc.getDoc(), aPos, std::move(pCode)); rDoc.setFormulaCell(aPos, pCell); + if (rDoc.getDoc().GetNumberFormat(aPos.Col(), aPos.Row(), aPos.Tab()) % SV_COUNTRY_LANGUAGE_OFFSET == 0) + pCell->SetNeedNumberFormat(true); rCache.store(aPos, pCell); } } |