summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sw/qa/extras/ooxmlimport/data/tdf122224.docxbin0 -> 19306 bytes
-rw-r--r--sw/qa/extras/ooxmlimport/ooxmlimport2.cxx11
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx9
3 files changed, 20 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlimport/data/tdf122224.docx b/sw/qa/extras/ooxmlimport/data/tdf122224.docx
new file mode 100644
index 000000000000..14518403cae1
--- /dev/null
+++ b/sw/qa/extras/ooxmlimport/data/tdf122224.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
index 833c2ed7e822..45480023495f 100644
--- a/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
+++ b/sw/qa/extras/ooxmlimport/ooxmlimport2.cxx
@@ -240,6 +240,17 @@ DECLARE_OOXMLIMPORT_TEST(testTdf116486, "tdf116486.docx")
CPPUNIT_ASSERT_EQUAL(OUString("4006"), aTop);
}
+DECLARE_OOXMLIMPORT_TEST(testTdf122224, "tdf122224.docx")
+{
+ uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<container::XIndexAccess> xTables(xTextTablesSupplier->getTextTables(),
+ uno::UNO_QUERY);
+ uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), uno::UNO_QUERY);
+ uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A2"), uno::UNO_QUERY_THROW);
+ // This was "** Expression is faulty **", because of the unnecessary DOCX number format string
+ CPPUNIT_ASSERT_EQUAL(OUString("2000"), xCell->getString());
+}
+
// tests should only be added to ooxmlIMPORT *if* they fail round-tripping in ooxmlEXPORT
CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 8114600a68aa..82db1031bc88 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -3217,6 +3217,15 @@ void DomainMapper_Impl::handleFieldFormula
uno::Reference< beans::XPropertySet > const& xFieldProperties)
{
OUString command = pContext->GetCommand().trim();
+
+ // Remove number formatting from \# to end of command
+ // TODO: handle custom number formatting
+ sal_Int32 delimPos = command.indexOf("\\#");
+ if (delimPos != -1)
+ {
+ command = command.replaceAt(delimPos, command.getLength() - delimPos, "").trim();
+ }
+
// command must contains = and at least another char
if (command.getLength() < 2)
return;