summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-03-10 15:44:59 +0100
committerLászló Németh <nemeth@numbertext.org>2020-03-11 08:38:09 +0100
commit116cadb5d2582532c69677a2f8499e8e9b7b9b80 (patch)
tree19643535829e1438655f57697a9f847896ea19e1 /sw
parentc63148ba139bd6b9ae7a0f9e24e51f29e5370963 (diff)
tdf#59274 DOCX import: fix tables with incomplete grid
Fix layout of "auto" width tables with incomplete grids, where table width is defined by cells of an arbitrary table row, not necessarily the first row, and last cells of the rows can be wider, than their saved values. Change-Id: I68bc8f1a4f57f3c64d0e83c585f2be129d9b5a84 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/90261 Tested-by: László Németh <nemeth@numbertext.org> Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf59274.docxbin0 -> 5167 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport10.cxx14
2 files changed, 14 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf59274.docx b/sw/qa/extras/ooxmlexport/data/tdf59274.docx
new file mode 100644
index 000000000000..38aad9ae9137
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf59274.docx
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
index 75403a4deeb9..1979a5180ec3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport10.cxx
@@ -378,6 +378,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73389,"fdo73389.docx")
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tbl/w:tblPr/w:tblW","w","5000");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf59274, "tdf59274.docx")
+{
+ // Table with "auto" table width and incomplete grid: 11 columns, but only 4 gridCol elements.
+ xmlDocPtr pXmlDoc = parseExport();
+
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW", "type", "dxa");
+ // This was 7349: sum of the cell widths in first row, but the table width is determined by a longer row later.
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW", "w", "9048");
+ // This was 1224: too narrow first cell in first row
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:tcPr/w:tcW", "w", "4291");
+ // This was 3674: too wide last cell in first row
+ assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[4]/w:tcPr/w:tcW", "w", "1695");
+}
+
DECLARE_OOXMLEXPORT_TEST(testDMLGroupshapeSdt, "dml-groupshape-sdt.docx")
{
uno::Reference<drawing::XShapes> xGroupShape(getShape(1), uno::UNO_QUERY);