summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-03-06 22:26:17 +0100
committerLászló Németh <nemeth@numbertext.org>2020-03-10 08:27:02 +0100
commit6db846c3c0bc1c44da1f3c7a8dea385930acc3b1 (patch)
treee3f1c9f7fd09102976f45e5a9db09e967de582d9
parentf62079a210ac14b2bc934dcc93bfecf45a53208e (diff)
tdf#107626 DOCX table export: fix missing trailing cells
resulting broken table layout with incomplete cell merging, for example, content in extra table rows and in columns of different lengths. Change-Id: Ic5057e43d4c66e34ffc1373030be66815ff52563 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90136 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf107626.odtbin0 -> 12912 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport9.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx17
3 files changed, 23 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf107626.odt b/sw/qa/extras/ooxmlexport/data/tdf107626.odt
new file mode 100644
index 000000000000..b7c8489cd341
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf107626.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
index 991916ef6ca8..3b2c22e7e2d6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx
@@ -324,6 +324,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf118812, "tdf118812_tableStyles-compre
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[6]/w:tc/w:p/w:r[2]/w:rPr/w:sz", "val", "16");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf107626, "tdf107626.odt")
+{
+ xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ // This was 2 (missing trailing cell in merged cell range)
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc", 3);
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf106970, "tdf106970.docx")
{
// The second paragraph (first numbered one) had 0 bottom margin:
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 6b8d1f9a1085..dc840a227e38 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -945,9 +945,24 @@ void DocxAttributeOutput::FinishTableRowCell( ww8::WW8TableNodeInfoInner::Pointe
sal_Int32 nClosedCell = lastClosedCell.back();
if (nCell == nClosedCell)
{
- //Start missing trailing cell
+ //Start missing trailing cell(s)
++nCell;
StartTableCell(pInner, nCell, nRow);
+
+ //Continue on missing next trailing cell(s)
+ ww8::RowSpansPtr xRowSpans = pInner->getRowSpansOfRow();
+ sal_Int32 nRemainingCells = xRowSpans->size() - nCell;
+ for (sal_Int32 i = 1; i < nRemainingCells; ++i)
+ {
+ if (bForceEmptyParagraph)
+ {
+ m_pSerializer->singleElementNS(XML_w, XML_p);
+ }
+
+ EndTableCell(nCell);
+
+ StartTableCell(pInner, nCell, nRow);
+ }
}
if (bForceEmptyParagraph)