diff options
author | Pallavi Jadhav <pallavi.jadhav@synerzip.com> | 2014-04-29 18:44:16 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-05-07 09:34:26 +0200 |
commit | f6eb92406bd366c557bc07810649e7ab3d1db614 (patch) | |
tree | 4cb3f2179d280dc96cc0ee886d95f45108b9f621 /sw | |
parent | 65f127f687916c8166d483a2769d2c344b0314e6 (diff) |
fdo#77812 :FILESAVE :DOCX : Extra Section Break gets added in file
Issue :
LO was exporting DOCX containing MultiColumns with additional
Section break Continuos.
Implementation :
1] Added check for Column_count in MSWordExportBase::WriteText()
If Column_count > 1 and Text node is empty then do not
export Section Break.
2] Written Export unit test case.
Conflicts:
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Reviewed on:
https://gerrit.libreoffice.org/9200
Change-Id: Ibf3e6bd2d4827aa77a659b1600939cc56d65a63b
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/fdo77812.docx | bin | 0 -> 13485 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 17 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtww8.cxx | 15 |
3 files changed, 32 insertions, 0 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/fdo77812.docx b/sw/qa/extras/ooxmlexport/data/fdo77812.docx Binary files differnew file mode 100644 index 000000000000..48fb498887e0 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/fdo77812.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 8c9938246074..acd3d0648c3b 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -3215,7 +3215,24 @@ DECLARE_OOXMLEXPORT_TEST(testFDO77725, "fdo77725.docx") assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[1]", 0); assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[2]", 0); assertXPath(pXmlFootnotes, "//w:footnotes[1]/w:footnote[3]/w:p[3]/w:r[1]/w:br[3]", 0); +} + +DECLARE_OOXMLEXPORT_TEST(testFDO77812, "fdo77812.docx") +{ + /* Additional sectPr was getting inserted and hence Column properties + * were getting added into this additional sectPr instead of Default setPr. + */ + xmlDocPtr pXmlDoc = parseExport("word/document.xml"); + if (!pXmlDoc) + return; + + // Check no additional section break is inserted. + assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:pPr/w:sectPr", 0); + // Check w:cols comes under Default sectPr + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols", "num", "2"); + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[1]", 1); + assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:cols/w:col[2]", 1); } DECLARE_OOXMLEXPORT_TEST(testContentTypeOLE, "fdo77759.docx") diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 718761ae5bc5..916d33f4417f 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -114,6 +114,7 @@ #include <editeng/charrotateitem.hxx> #include "WW8FibData.hxx" #include "numrule.hxx" +#include "fmtclds.hxx" using namespace css; using namespace sw::util; @@ -2597,6 +2598,20 @@ void MSWordExportBase::WriteText() } } } + else + { + /* Do not export Section Break in case DOCX containing MultiColumn and + * aIdx.GetNode().IsTxtNode() is False i.e. Text node is NULL. + */ + const SwFrmFmt* pPgFmt = rSect.GetFmt(); + const SwFmtCol& rCol = pPgFmt->GetCol(); + sal_uInt16 nColumnCount = rCol.GetNumCols(); + if(nColumnCount > 1) + { + bNeedExportBreakHere = sal_False; + } + } + if (bNeedExportBreakHere) //#120140# End of check { ReplaceCr( (char)0xc ); // indicator for Page/Section-Break |