From 8deb35f7665342775cf2c7a764df950a9223d59b Mon Sep 17 00:00:00 2001 From: László Németh Date: Tue, 1 Sep 2020 08:48:53 +0200 Subject: tdf#134649 DOCX export: fix page break between tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 (cherry picked from commit 4a96b2b7787900b6ca45e772daa0fc284b3a4e0f) Change-Id: Id02529d023a6306fb5be42486d25f252d8821f2f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102936 Tested-by: Gabor Kelemen Reviewed-by: Gabor Kelemen --- .../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(+) create mode 100644 sw/qa/extras/ooxmlexport/data/tdf134649_pageBreak.fodt 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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Two tables, one pagebreak: + + + + + + Hello1 + + + + + + + + World1 + + + + + + + + + + + + Hello2 + + + + + + + + World2 + + + + + + + + + + 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(&aNextIndex.GetNode()); + const SwFrameFormat *pFormat = pTableNode->GetTable().GetFrameFormat(); + m_rExport.OutputSectionBreaks(&(pFormat->GetAttrSet()), *pTableNode); + } } } -- cgit