summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLouis Meyrat <louis.meyrat@gmail.com>2020-01-12 17:26:09 +0100
committerMike Kaganski <mike.kaganski@collabora.com>2020-01-19 23:30:00 +0100
commit8be3ae254f5b2ff76d9861ad4b9b5b5de5d14bb4 (patch)
treef4d0989b887237de4b52766345bfb9b7982efef6 /sw
parent4ee7a2bd9cab311704a47d18e44a5a17a54d3d66 (diff)
tdf#128290 add tblLayout element to docx export
This will disable the automatic table width feature of MS Word, which does not exist in LO. Now, tables in LO-generated docx have the same column width in MS Word Change-Id: I955c8e5667376475e7c41e3b74d88e3513fec561 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86671 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf128290.odtbin0 -> 9782 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport14.cxx7
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx4
3 files changed, 11 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf128290.odt b/sw/qa/extras/ooxmlexport/data/tdf128290.odt
new file mode 100644
index 000000000000..81ea0c6773aa
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf128290.odt
Binary files differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
index 1835b92bec49..922cb9183adc 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -307,6 +307,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf77796, "tdf77796.docx")
assertXPath(pXml, "/w:document/w:body/w:tbl/w:tblPr/w:tblCellMar/w:end", "w", "108");
}
+DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf128290, "tdf128290.odt")
+{
+ xmlDocPtr pXml = parseExport("word/document.xml");
+ CPPUNIT_ASSERT(pXml);
+ assertXPath(pXml, "/w:document/w:body/w:tbl/w:tblPr/w:tblLayout", "type", "fixed");
+}
+
DECLARE_OOXMLIMPORT_TEST(testContSectBreakHeaderFooter, "cont-sect-break-header-footer.docx")
{
// Load a document with a continuous section break on page 2.
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 25b22b8df5ed..172205b11b50 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3771,6 +3771,10 @@ void DocxAttributeOutput::TableDefinition( ww8::WW8TableNodeInfoInner::Pointer_t
FSNS( XML_w, XML_w ), OString::number(nPageSize),
FSNS( XML_w, XML_type ), widthType );
+ // Disable layout autofit, as it does not exist in LibreOffice yet
+ m_pSerializer->singleElementNS( XML_w, XML_tblLayout,
+ FSNS( XML_w, XML_type ), "fixed" );
+
// Look for the table style property in the table grab bag
std::map<OUString, css::uno::Any> aGrabBag =
pTableFormat->GetAttrSet().GetItem<SfxGrabBagItem>(RES_FRMATR_GRABBAG)->GetGrabBag();