diff options
author | Justin Luth <justin.luth@collabora.com> | 2020-09-05 13:38:04 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2020-09-05 16:39:48 +0200 |
commit | 870bb98b3a1159e31895524ef54457db37d1b9af (patch) | |
tree | f5c7920482a475c7c10903a060c7e8a3e29162b0 | |
parent | d1708ea5ef42daea49368d159324a4ba11256e55 (diff) |
tdf#136441 ms export: don't export comments in footnotes
Microsoft UI does not allow comments in footnotes,
or in headers/footers, or endnotes,
so just throw them away for all MS formats.
This avoids the biggest problem,
which was an error in LO reading the DOCX.
Prior to this bug fix, the status was:
DOCX:
Word 2016 opens it ok, but no comment in footnote.
Word 2003 hangs.
LO loads but has a SAX error the user must ignore,
and no comment seen in the footnote anyway.
DOC:
Word 2016 opens, but misses the main body text,
and of course no comment in footnote.
Word 2003 opens, sees the main body text just fine,
and no comment in footnote.
LO loads, but no comment seen in footnote anyway.
RTF:
Word 2016/2003 open, and no comment in footnote.
LO loads, but no comment seen in footnote anyway.
If the SAX error problem could be fixed, then perhaps
it would be worth allowing LO to export comments
to DOCX for its own benefit. In that case, allow
case SwFieldIds::Postit:
PostitField( pField );
This patch does not fix the problem where the body
text is missing in Word 2016 in DOC format.
Change-Id: I0b7389616a2207d41ae525dbc0b2eea536364d90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102074
Tested-by: Jenkins
Reviewed-by: Justin Luth <justin_luth@sil.org>
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt | bin | 0 -> 11777 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport15.cxx | 6 | ||||
-rw-r--r-- | sw/source/filter/ww8/wrtw8nds.cxx | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt b/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt Binary files differnew file mode 100644 index 000000000000..61c9632b3972 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/tdf136441_commentInFootnote.odt diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx index 8d6e8228f8ba..4e39a5af0297 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport15.cxx @@ -478,6 +478,12 @@ DECLARE_OOXMLEXPORT_TEST(testTdf135329_lostImage, "tdf135329_lostImage.odt") uno::Reference<beans::XPropertySet> xImageProps(getShape(2), uno::UNO_QUERY_THROW); } +DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf136441_commentInFootnote, "tdf136441_commentInFootnote.odt") +{ + // failed to load without error if footnote contained a comment. + // (MS Word's UI doesn't allow adding comments to a footnote.) +} + DECLARE_OOXMLEXPORT_TEST(testTdf134063, "tdf134063.docx") { CPPUNIT_ASSERT_EQUAL(2, getPages()); diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index a1f8965b686e..11f8b88059c5 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -2374,7 +2374,9 @@ void MSWordExportBase::OutputTextNode( SwTextNode& rNode ) // Append bookmarks in this range after flys, exclusive of final // position of this range AppendBookmarks( rNode, nCurrentPos, nNextAttr - nCurrentPos ); - AppendAnnotationMarks(aAttrIter, nCurrentPos, nNextAttr - nCurrentPos); + //Sadly only possible for word in main document text + if ( m_nTextTyp == TXT_MAINTEXT ) + AppendAnnotationMarks(aAttrIter, nCurrentPos, nNextAttr - nCurrentPos); // At the moment smarttags are only written for paragraphs, at the // beginning of the paragraph. |