Bug 114734 - FILEOPEN DOCX: Comment direction lost on saving-then-reloading a .docx
Summary: FILEOPEN DOCX: Comment direction lost on saving-then-reloading a .docx
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: All All
: medium normal
Assignee: Justin L
URL:
Whiteboard: target:7.5.0
Keywords: filter:docx, text:rtl
: 142518 (view as bug list)
Depends on:
Blocks: RTL-CTL DOCX-Comments
  Show dependency treegraph
 
Reported: 2017-12-28 14:56 UTC by Eyal Rozenberg
Modified: 2023-05-24 03:24 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
A document for reproducing the bug (5.29 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2018-09-17 19:41 UTC, Eyal Rozenberg
Details
bug_114734_msWord2003.docx: contains <w:bidi/> in comment.xml (11.78 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2022-06-24 13:52 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eyal Rozenberg 2017-12-28 14:56:11 UTC
Description:
If you set the direction of a comment (in a docx-imported file) from LTR to RTL, then save, close the file, and reopen - the direction seems to be reverse - RTL.

Steps to Reproduce:
See above

Actual Results:  
Direction of words gets reversed

Expected Results:
Direction shouldn't be reversed


Reproducible: Always


User Profile Reset: No



Additional Info:
Linux Mint 18.3, LO 6.0.0.beta2


User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:57.0) Gecko/20100101 Firefox/57.0
Comment 1 Dieter 2017-12-29 16:57:06 UTC
I confirm it with

Version: 5.4.4.2 (x64)
Build-ID: 2524958677847fb3bb44820e40380acbe820f960
CPU-Threads: 4; BS: Windows 6.19; UI-Render: Standard; 
Gebietsschema: it-IT (de_DE); Calc: group
Comment 2 Eyal Rozenberg 2018-09-17 19:34:14 UTC
Bug still manifests with:

Version: 6.1.1.2
Build ID: 5d19a1bfa650b796764388cd8b33a5af1f5baa1b
CPU threads: 4; OS: Linux 4.15; UI render: default; VCL: gtk2; 
Locale: en-GB (en_GB.UTF-8); Calc: group threaded
Comment 3 Eyal Rozenberg 2018-09-17 19:38:27 UTC
In fact, the bug applies more generally than I had previously thought - it doesn't require importing a DOCX:

1. Create a new Writer document
2. Make sure the default style's direction is LTR
3. Type in some text (doesn't really matter, you could just comment on an empty paragraph, but to be nice.)
4. Insert a comment with a single paragraph of text - enough text  to require multiple lines in the comment box
5. Set the comment box paragraph's direction to RTL, manually
6. Save as DOCX
7. Close the document
8. Open the file you just saved

The comment will have LTR direction.  If you do this via an ODT rather than a DOCX (in step 6) you won't get this bug.
Comment 4 Eyal Rozenberg 2018-09-17 19:41:08 UTC
Created attachment 144958 [details]
A document for reproducing the bug

The bug doesn't manifest by loading this document; you need to take the last several steps of the reproduction instructions:

5. Set the comment box paragraph's direction to RTL, manually
6. Save as DOCX
7. Close the document
8. Open the file you just saved

And you'll see the bug.
Comment 5 QA Administrators 2019-09-18 02:54:06 UTC Comment hidden (obsolete)
Comment 6 Eyal Rozenberg 2019-09-18 20:05:23 UTC
I am experiencing this bug EVERY SINGLE DAMN DAY (!)  ... comment direction setting is currently _the_ most annoying broken LO RTL issue AFAIC.

Seeing this right now with:

Version: 6.3.1.2
Build ID: 1:6.3.1-1
CPU threads: 4; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: he-IL (en_IL); UI-Language: en-US
Calc: threaded
Comment 7 Gabor Kelemen (allotropia) 2021-05-27 16:28:39 UTC
*** Bug 142518 has been marked as a duplicate of this bug. ***
Comment 8 Justin L 2022-06-24 13:52:40 UTC
Created attachment 180947 [details]
bug_114734_msWord2003.docx: contains <w:bidi/> in comment.xml

Yes, DOCX has the ability to render this. I had to use MS Word 2003 to modify the example file.

So LO fails in both import and export to handle bidi in comments.
Comment 9 Justin L 2022-06-30 23:04:44 UTC
Import exception writerfilter/source/dmapper/DomainMapper_Impl.cxx:2550: finishParagraph() com.sun.star.beans.UnknownPropertyException message: "Unknown property: ParaStyleName at /persistent/git/libreoffice2/editeng/source/uno/unotext.cxx:1980"

Also - watch out that you aren't bitten by Left/Right justify changes...


For export, we currently don't export any paragraph properties in WriteOutliner (aka draw stuff) in any of DOC/RTF/DOCX.
Comment 10 Eyal Rozenberg 2022-07-01 07:02:20 UTC
(In reply to Justin L from comment #9)
> Also - watch out that you aren't bitten by Left/Right justify changes...

Well, if I saved something to a DOCX a certain way, I should just get it the same way when I load... but perhaps I'm not following you?

> For export, we currently don't export any paragraph properties in
> WriteOutliner (aka draw stuff) in any of DOC/RTF/DOCX.

I'm pretty much clueless about the file formats. What kind of "draw stuff" are you not exporting? It seems to me like most things do get exported. Again, sorry for being dense; please try giving me the newbie explanation here.
Comment 11 Commit Notification 2022-07-11 20:11:32 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/cf02b94bc513ee1b742b4c5d7174632b568e8b72

tdf#114734 writerfilter: avoid PostIt exception

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Eyal Rozenberg 2022-07-11 21:00:48 UTC
(In reply to Commit Notification from comment #11)

> Comments (aka AnnotationMarks) cannot contain
> a paragraph style. The exception was causing
> all properties to be dropped.

So, I saw you add an "in comments" condition in a few places. Does that mean that, now, comments _can_ contain a paragraph style? If not, I don't quite see how your commit only affects direction.

> IIRC, LO interally always refers to justify literally,
> while DOCX normally depends on the RtL context,
> treating LEFT as START and RIGHT as END.

See also my bug 131192 about Left/Right vs Start/End.
Comment 13 Commit Notification 2022-07-12 18:31:37 UTC
Justin Luth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/a73daa562c82a5c058a217ba80035da08d40451d

tdf#114734 docx export: save comment paragraph properties

It will be available in 7.5.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 14 Dieter 2022-07-31 09:28:09 UTC
VERIFED with

Version: 7.5.0.0.alpha0+ (x64) / LibreOffice Community
Build ID: 4827d5cb1508f6bca9489e31b877cfff36393c50
CPU threads: 4; OS: Windows 10.0 Build 19044; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Justin, thank you for fixing it!
Comment 15 Shane Clay 2023-05-24 03:24:56 UTC Comment hidden (spam)