summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2020-09-01 08:48:53 +0200
committerLászló Németh <nemeth@numbertext.org>2020-09-02 08:01:44 +0200
commit4a96b2b7787900b6ca45e772daa0fc284b3a4e0f (patch)
tree160a4374620b5175842bdd16736e85a4107f5c69 /sw
parent4d33262b1b652b57f222c9f1cce7d976725399d4 (diff)
tdf#134649 DOCX export: fix page break between tables
Section break between tables wasn't exported, resulting missing page break and table content. For example, a table on a new landscape page was merged to the previous table, removing not only the landscape page, but hiding half of the table because of the narrower width of the previous page with portrait orientation. Change-Id: Id02529d023a6306fb5be42486d25f252d8821f2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101823 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt86
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport15.cxx6
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx7
3 files changed, 99 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt b/sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt
new file mode 100644
index 000000000000..7d05c3e3ce99
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
+ <office:styles>
+ <style:default-style style:family="paragraph">
+ </style:default-style>
+ <style:default-style style:family="table">
+ <style:table-properties table:border-model="collapsing"/>
+ </style:default-style>
+ <style:default-style style:family="table-row">
+ <style:table-row-properties fo:keep-together="auto"/>
+ </style:default-style>
+ <style:style style:name="Standard" style:family="paragraph" style:class="text"/>
+ <style:style style:name="Heading" style:family="paragraph" style:parent-style-name="Standard" style:next-style-name="Text_20_body" style:class="text">
+ </style:style>
+ <style:style style:name="Text_20_body" style:display-name="Text body" style:family="paragraph" style:parent-style-name="Standard" style:class="text">
+ </style:style>
+ <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra">
+ </style:style>
+ </office:styles>
+ <office:automatic-styles>
+ <style:style style:name="Table1" style:family="table">
+ <style:table-properties style:width="11.509cm" table:align="left"/>
+ </style:style>
+ <style:style style:name="Table2" style:family="table" style:master-page-name="Landscape">
+ <style:table-properties style:page-number="auto" table:align="margins"/>
+ </style:style>
+ <style:page-layout style:name="pm1">
+ <style:page-layout-properties fo:page-width="21.59cm" fo:page-height="27.94cm" style:print-orientation="portrait"/>
+ </style:page-layout>
+ <style:page-layout style:name="pm2">
+ <style:page-layout-properties fo:page-height="21.59cm" fo:page-width="27.94cm" style:print-orientation="landscape"/>
+ <style:header-style/>
+ <style:footer-style/>
+ </style:page-layout>
+ </office:automatic-styles>
+ <office:master-styles>
+ <style:master-page style:name="Standard" style:page-layout-name="pm1"/>
+ <style:master-page style:name="Landscape" style:page-layout-name="pm2"/>
+ </office:master-styles>
+ <office:body>
+ <office:text text:use-soft-page-breaks="true">
+ <text:p>Two tables, one pagebreak:</text:p>
+ <table:table table:name="Table1" table:style-name="Table1">
+ <table:table-column/>
+ <table:table-column/>
+ <table:table-row>
+ <table:table-cell office:value-type="string">
+ <text:p>Hello1</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string">
+ <text:p text:style-name="Table_20_Contents"/>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell office:value-type="string">
+ <text:p>World1</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string">
+ <text:p text:style-name="Table_20_Contents"/>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <table:table table:name="Table2" table:style-name="Table2">
+ <table:table-column/>
+ <table:table-column/>
+ <table:table-row>
+ <table:table-cell office:value-type="string">
+ <text:p>Hello2</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string">
+ <text:p text:style-name="Table_20_Contents"/>
+ </table:table-cell>
+ </table:table-row>
+ <table:table-row>
+ <table:table-cell office:value-type="string">
+ <text:p>World2</text:p>
+ </table:table-cell>
+ <table:table-cell office:value-type="string">
+ <text:p text:style-name="Table_20_Contents"/>
+ </table:table-cell>
+ </table:table-row>
+ </table:table>
+ <text:p/>
+ </office:text>
+ </office:body>
+</office:document>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
index 397b9040e026..65004941acc6 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx
@@ -263,6 +263,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf133370_columnBreak, "tdf133370_columnBreak.odt")
CPPUNIT_ASSERT_EQUAL(1, getPages());
}
+DECLARE_OOXMLEXPORT_TEST(testTdf134649_pageBreak, "tdf134649_pageBreak.fodt")
+{
+ // This was 1 (missing page break between tables).
+ CPPUNIT_ASSERT_EQUAL(2, getPages());
+}
+
DECLARE_OOXMLEXPORT_TEST(testTdf135343_columnSectionBreak_c14, "tdf135343_columnSectionBreak_c14.docx")
{
uno::Reference<beans::XPropertySet> xTextSection = getProperty<uno::Reference<beans::XPropertySet>>(getParagraph(1), "TextSection");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 4bd72ebf247a..6a1593d265e4 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1027,6 +1027,13 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& rNode)
if (rNode.StartOfSectionNode()->IsTableNode() || rNode.StartOfSectionNode()->IsSectionNode())
m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode, m_tableReference->m_bTableCellOpen);
}
+ else if (aNextIndex.GetNode().IsTableNode())
+ {
+ // Handle section break between tables.
+ const SwTableNode* pTableNode = static_cast<SwTableNode*>(&aNextIndex.GetNode());
+ const SwFrameFormat *pFormat = pTableNode->GetTable().GetFrameFormat();
+ m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), *pTableNode);
+ }
}
}