sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt | 86 +++++++++++++++++ sw/qa/extras/ooxmlexport/ooxmlexport14.cxx | 6 + sw/source/filter/ww8/docxattributeoutput.cxx | 7 + 3 files changed, 99 insertions(+)
New commits: commit 8deb35f7665342775cf2c7a764df950a9223d59b Author: László Németh <nem...@numbertext.org> AuthorDate: Tue Sep 1 08:48:53 2020 +0200 Commit: Gabor Kelemen <kelemen.gab...@nisz.hu> CommitDate: Fri Sep 18 09:19:23 2020 +0200 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. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101823 Tested-by: Jenkins Reviewed-by: László Németh <nem...@numbertext.org> (cherry picked from commit 4a96b2b7787900b6ca45e772daa0fc284b3a4e0f) Change-Id: Id02529d023a6306fb5be42486d25f252d8821f2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102936 Tested-by: Gabor Kelemen <kelemen.gab...@nisz.hu> Reviewed-by: Gabor Kelemen <kelemen.gab...@nisz.hu> 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/ooxmlexport14.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx index 3d0f8f91a172..6831c1ae634f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport14.cxx @@ -485,6 +485,12 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf118701, "tdf118701.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[10]/w:pPr[1]/w:numPr", 1); } +DECLARE_OOXMLEXPORT_TEST(testTdf134649_pageBreak, "tdf134649_pageBreak.fodt") +{ + // This was 1 (missing page break between tables). + CPPUNIT_ASSERT_EQUAL(2, getPages()); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index bc01bc3d5c6f..a6020b2568a1 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -1029,6 +1029,13 @@ void DocxAttributeOutput::SectionBreaks(const SwNode& rNode) if (rNode.StartOfSectionNode()->IsTableNode() || rNode.StartOfSectionNode()->IsSectionNode()) m_rExport.OutputSectionBreaks(pTextNode->GetpSwAttrSet(), *pTextNode, m_tableReference->m_bTableCellOpen, pTextNode->GetText().isEmpty()); } + 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); + } } } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits