diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2016-06-17 21:22:02 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-07-04 03:35:09 +0000 |
commit | 21a3d78cf080dc4d86edab2a7378055a2d848bfe (patch) | |
tree | 791003f2d65d18b4dd0b669d760e0430cc2c0dd6 /sc | |
parent | bb01a3536d6446864f81a81b626461f8defe5da3 (diff) |
tdf#100458 Don't forcefully change cell type
Just quoting the source comment from the breaking commit
61c39eae570d6d6040b65bfe93127b30e6080cc8.
// If a matrix formula has a matrix reference cell that is intended to
// have // a blank text result, the matrix reference cell is actually
// saved(export) as a float cell with 0 as the value and empty <text:p/>.
Ok
// Import works around this by setting these cells as text cells so that
// the blank text is used for display instead of the number 0.
This seems to be wrong.
Forcing the cell to a util::NumberFormat::TEXT actually kills
the cell value, if the text is a result of the formular.
I'm not sure if forcefully changing the cell format at this point is
correct at any time, if a cell type was already determinated.
I imagine that an undefined cell type should probably be fixed at the
end of the row import, if Calc detected an error case, or even generally,
This patch is just a minimalistic initial fix. If it's correct, it
probably needs an additional code comment.
Change-Id: If7d9d69467d56c7d8fd2444f9e8b3ae906285264
Reviewed-on: https://gerrit.libreoffice.org/26435
Reviewed-by: Eike Rathke <erack@redhat.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Diffstat (limited to 'sc')
-rw-r--r-- | sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods | bin | 0 -> 6965 bytes | |||
-rw-r--r-- | sc/qa/unit/subsequent_filters-test.cxx | 14 | ||||
-rw-r--r-- | sc/source/filter/xml/xmlcelli.cxx | 1 |
3 files changed, 14 insertions, 1 deletions
diff --git a/sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods b/sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods Binary files differnew file mode 100644 index 000000000000..afc65e7c1a61 --- /dev/null +++ b/sc/qa/unit/data/ods/tdf100458_lost_zero_value.ods diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 0c1428ec3c06..35f0cbe9d961 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -215,6 +215,8 @@ public: void testBnc762542(); + void testTdf100458(); + CPPUNIT_TEST_SUITE(ScFiltersTest); CPPUNIT_TEST(testBooleanFormatXLSX); CPPUNIT_TEST(testBasicCellContentODS); @@ -318,6 +320,8 @@ public: CPPUNIT_TEST(testHiddenSheetsXLSX); + CPPUNIT_TEST(testTdf100458); + CPPUNIT_TEST_SUITE_END(); private: @@ -3328,6 +3332,16 @@ void ScFiltersTest::testRelFormulaValidationXLS() xDocSh->DoClose(); } +void ScFiltersTest::testTdf100458() +{ + ScDocShellRef xDocSh = loadDoc("tdf100458_lost_zero_value.", FORMAT_ODS); + CPPUNIT_ASSERT_MESSAGE("Failed to open doc", xDocSh.Is()); + ScDocument& rDoc = xDocSh->GetDocument(); + CPPUNIT_ASSERT(rDoc.HasValueData(0, 0, 0)); + CPPUNIT_ASSERT_EQUAL(double(0.0), rDoc.GetValue(0,0,0)); + CPPUNIT_ASSERT(!rDoc.HasStringData(0, 0, 0)); +} + ScFiltersTest::ScFiltersTest() : ScBootstrapFixture( "sc/qa/unit/data" ) { diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx index 149435ec3766..c8825fef003e 100644 --- a/sc/source/filter/xml/xmlcelli.cxx +++ b/sc/source/filter/xml/xmlcelli.cxx @@ -1511,7 +1511,6 @@ void ScXMLTableRowCellContext::EndElement() if( bFormulaTextResult && (mbPossibleErrorCell || mbCheckWithCompilerForError) ) { maStringValue.reset(GetFirstParagraph()); - nCellType = util::NumberFormat::TEXT; } ScAddress aCellPos = rXMLImport.GetTables().GetCurrentCellPos(); |