If there is a bookmark at the end of a paragraph, the bookmark is not exported correctly to DOCX. Two types of errors are possible (but I think they have the same cause): a) if there is a collapsed bookmark (at paragraph end), it is exported to the beginning of the paragraph b) if there is a bookmark that extends over contents (at paragraph end), it is collapsed *before* the content. How to reproduce: 1) create a new Document in Writer 2) add two paragraphs with content "foo" (first par) and "bar" (second par) 3) place the curser after the "o" of "foo" 4) insert a bookmark "a" 5) mark the content "r" in "bar" 6) insert a bookmark "b" 7) save the file as DOCX (Microsoft Word 2007/2010 XML) 8) look at the generated word/document.xml (inside the docx file) you will find the following RESULT (first paragraph = case a): <w:p> <w:pPr> <w:pStyle w:val="style0"/> </w:pPr> <w:bookmarkStart w:id="0" w:name="a"/> <w:bookmarkEnd w:id="0"/> <w:r> <w:rPr/> <w:t>Foo</w:t> </w:r> </w:p> where the EXPECTED result for the first paragraph (case a) is: <w:p> <w:pPr> <w:pStyle w:val="style0"/> </w:pPr> <w:r> <w:rPr/> <w:t>Foo</w:t> </w:r> <w:bookmarkStart w:id="0" w:name="a"/> <w:bookmarkEnd w:id="0"/> </w:p> And the RESULT for the second paragraph (case b) is: <w:p> <w:pPr> <w:pStyle w:val="style0"/> </w:pPr> <w:r> <w:rPr/> <w:t>ba</w:t> </w:r> <w:bookmarkStart w:id="1" w:name="b"/> <w:bookmarkEnd w:id="1"/> <w:r> <w:rPr/> <w:t>r</w:t> </w:r> </w:p> where the EXPECTED result for the second paragraph (case b) is: <w:p> <w:pPr> <w:pStyle w:val="style0"/> </w:pPr> <w:r> <w:rPr/> <w:t>ba</w:t> </w:r> <w:bookmarkStart w:id="1" w:name="b"/> <w:r> <w:rPr/> <w:t>r</w:t> </w:r> <w:bookmarkEnd w:id="1"/> </w:p> BTW: if the bookmark is in any other position within the paragraph, it is exported correctly. The bug only occurs if the bookmark is the last element in the paragraph.
I can confirm this using Linux Mint 15 x64 with LibreOffice Version: 4.2.0.0.alpha0+ Build ID: 87c50e75633f31b54bfa1758cc0921ac53c6b418 It looks like it's even a bit more worse: <w:p> <w:pPr> <w:pStyle w:val="style0"/> <w:rPr> </w:rPr> </w:pPr> <w:bookmarkStart w:id="0" w:name="a"/> <w:bookmarkEnd w:id="0"/> <w:r> <w:rPr> </w:rPr> <w:t>Foo</w:t> </w:r> </w:p> More in particular the added no-sense extra <w:rPr></w:rPr> Kind regards, Joren Code pointer: http://opengrok.libreoffice.org/xref/core/sw/source/filter/ww8/docxattributeoutput.cxx#678
One additional (but possibly related) case where the positioning of bookmark tags is incorrect appears to be when a bookmark spans two or more formatting elements. Steps to reproduce: 1) create a new Document in Writer 2) add "foo bar" (as a single paragraph) 3) highlight "foo" and make it bold. highlight "bar" and make it italic 4) select the whole line (i.e. "foo bar") and add bookmark. Name it "test" 7) save the file as DOCX (Microsoft Word 2007/2010 XML) 8) look at the generated word/document.xml (inside the docx file) Observed result (pPr section omitted): <w:p> <w:bookmarkStart w:id="0" w:name="test" /> <w:r> <w:rPr> <w:b /> <w:bCs /> </w:rPr> <w:t>foo</w:t> </w:r> <w:r> <w:rPr></w:rPr> <w:t xml:space="preserve"> </w:t> </w:r> <w:bookmarkEnd w:id="0" /> <w:r> <w:rPr> <w:i /> <w:iCs /> </w:rPr> <w:t>bar</w:t> </w:r> </w:p> Expected result: <w:p> <w:bookmarkStart w:id="0" w:name="test" /> <w:r> <w:rPr> <w:b /> <w:bCs /> </w:rPr> <w:t>foo</w:t> </w:r> <w:r> <w:rPr></w:rPr> <w:t xml:space="preserve"> </w:t> </w:r> <w:r> <w:rPr> <w:i /> <w:iCs /> </w:rPr> <w:t>bar</w:t> </w:r> <w:bookmarkEnd w:id="0" /> </w:p> It seems that no matter how many <w:r> elements the bookmark is supposed to encompass, it is always ended after the second one.
** Please read this message in its entirety before responding ** To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present on a currently supported version of LibreOffice (4.4.2 or later) https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the version of LibreOffice and your operating system, and any changes you see in the bug behavior If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a short comment that includes your version of LibreOffice and Operating System Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) http://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to "inherited from OOo"; 4b. If the bug was not present in 3.3 - add "regression" to keyword Feel free to come ask questions or to say hello in our QA chat: http://webchat.freenode.net/?channels=libreoffice-qa Thank you for your help! -- The LibreOffice QA Team This NEW Message was generated on: 2015-05-02
Reproduced in LO 5.1.4 (Linux amd64)
Szymon Kłos committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=50915bababcf6b645fe3b57c265560a3cd0c6224 tdf#65955 DOCX: bookmarks at the end of paragraph It will be available in 6.0.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Szymon Kłos committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=76f28863e7974da5a7280b3efa8a157c114ca03c tdf#65955 Bookmarks on two paragraphs It will be available in 6.1.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Szymon Kłos committed a patch related to this issue. It has been pushed to "libreoffice-6-0": http://cgit.freedesktop.org/libreoffice/core/commit/?id=948626d46f755fd7c0b2da6b559b4c24f5590f67&h=libreoffice-6-0 tdf#65955 Bookmarks on two paragraphs It will be available in 6.0.0.1. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.