summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Meyrat <louis.meyrat@gmail.com>2020-01-12 17:26:09 +0100
committerMichael Stahl <michael.stahl@allotropia.de>2021-11-09 15:34:42 +0100
commit005952a5ec6737c8cb34a29d373e252a00c84916 (patch)
tree0eb8a6d481fd4acecf3cfedddf44b70778db4735
parent8417f6b94e55b35179ce636627dfb7f0b2474a6f (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> (cherry picked from commit 8be3ae254f5b2ff76d9861ad4b9b5b5de5d14bb4)
-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 18a22bbdd30c..4531e95f2e06 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx
@@ -446,6 +446,13 @@ DECLARE_OOXMLEXPORT_TEST(testTdf120394, "tdf120394.docx")
}
}
+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_OOXMLEXPORT_TEST(testHyphenationAuto, "hyphenation.odt")
{
// Explicitly set hyphenation=auto on document level
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 0eb2a733ac33..d76fff47197f 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -3821,6 +3821,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();