Download it now!
Bug 72017 - FILEOPEN: DOCX: RTL paragraphs with left alignment open with right alignment and vice versa
Summary: FILEOPEN: DOCX: RTL paragraphs with left alignment open with right alignment ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: Other All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: filter:docx
Depends on:
Blocks: DOCX-Paragraph RTL-Arabic
  Show dependency treegraph
 
Reported: 2013-11-26 05:03 UTC by smnitin
Modified: 2018-07-25 07:13 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Arabic document with alignment issue (9.67 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-11-26 05:03 UTC, smnitin
Details
pdf from word 2013 after ignoring the error message (155.95 KB, application/pdf)
2018-07-25 07:07 UTC, Justin L
Details

Note You need to log in before you can comment on or make changes to this bug.
Description smnitin 2013-11-26 05:03:07 UTC
Created attachment 89808 [details]
Arabic document with alignment issue

Alignment of Arabic text should be from right to left. But the writer is showing
left to right like normal text.
Comment 1 Maxim Monastirsky 2013-11-26 09:27:04 UTC
The attached file opens as RTL with both Word 2010 SP2 and LibreOffice  4.3.0.0.alpha0+ Build ID: 732ec36edfd09d2091d70c4d71b5f182fe279c45. The problem is with the alignment: In Word the first two lines are left aligned, and the rest are right aligned. In LibreOffice it's mirrored, as the first two lines are right aligned, and the rest are left aligned.

When opening the attached file using Word 2010 SP2, I get a message that it's corrupted (empty font name in word\fontTable.xml). It's probably related to Bug 64232 (support of MS Office 'Themes').

@smnitin: Hi, It looks like this file was originally created using Word, and then resaved using LibreOffice (see docProps\app.xml). Would be great if you could also attach the original docx file (before the resave), so we could check if there is also a saving bug in the latest dev builds.
Comment 2 QA Administrators 2015-04-19 03:22:20 UTC Comment hidden (obsolete)
Comment 3 Buovjaga 2015-06-18 13:59:55 UTC
All lines seem left-aligned now.

Win 7 Pro 64-bit Version: 5.1.0.0.alpha1+
Build ID: 437210d58f32177ef1829d704f7f4d2f1bbfbfdd
TinderBox: Win-x86@39, Branch:master, Time: 2015-06-18_07:21:56
Locale: fi-FI (fi_FI)
Comment 4 QA Administrators 2016-09-20 10:10:30 UTC Comment hidden (obsolete)
Comment 5 Lior Kaplan 2017-10-13 13:27:52 UTC
Still happens in LibreOffice 5.4.1.

Text direction is RTL but alignment is left, while in the original document it was aligned right.
Comment 6 Yousuf Philips (jay) (retired) 2017-10-15 21:39:39 UTC
Would have been useful to know where attachment 89808 [details] originated, as it wasnt created by MS Word as 2007 and 2010 both state that it required repairing and when saving it from 2007 or 2010, LO could open those files correctly.

So the document has XML like this for the line which is supposed to be right aligned

 <w:p>
   <w:pPr>
     <w:pStyle w:val="Normal" />
     <w:jc w:val="right" />
     <w:rPr>
       <w:rtl w:val="true" />
       <w:lang w:bidi="ar-AE" />
     </w:rPr>
   </w:pPr>
   <w:r>
     <w:rPr>
       <w:rtl w:val="true" />
       <w:lang w:bidi="ar-AE" />
     </w:rPr>
   </w:r>
 </w:p>

And Word 2007 has XML like this

 <w:p ...>
   <w:pPr>
     <w:jc w:val="right" />
     <w:rPr>
       <w:rtl />
       <w:lang w:bidi="ar-AE" />
     </w:rPr>
   </w:pPr>
 </w:p>

Justin, Mike: Any thoughts?
Comment 7 Justin L 2017-10-16 08:23:05 UTC
I don't see any bibisect info, but I can confirm that the document opens this way from earliest times (bibisect43all 3.5 is as far back as I can go.)

I disagree with comment 3 - the first two (empty) paragraphs are right aligned, and the rest or left aligned - same as always.

Comment 6 is a little misleading.  The first two paragraphs have XML that look like that - but those two paragraphs are also right-aligned. The remaining paragraphs (which are left aligned) all specify left alignment.
<w:pPr>
  <w:pStyle w:val="Normal"/>
  <w:jc w:val="left"/>
  <w:rPr>
    <w:rtl w:val="true"/>
    <w:lang w:bidi="ar-AE"/>
  </w:rPr>
</w:pPr>
<w:r>
  <w:rPr>
    <w:rtl w:val="true"/>
    <w:lang w:bidi="ar-AE"/>
  </w:rPr>
</w:r>

I'd say that LO is doing things properly.  "The possible values for this attribute [w:jc] are always specified relative to the page, and do not change semantic from right-to-left and left-to-right documents."

I'd mark this as NotABug since the document is corrupt.
Comment 8 Buovjaga 2017-10-16 10:11:31 UTC
Ok, let's close so this doesn't hang in a limbo forever.
Comment 9 Yousuf Philips (jay) (retired) 2017-10-16 11:05:59 UTC
(In reply to Justin L from comment #7)
> I don't see any bibisect info, but I can confirm that the document opens
> this way from earliest times (bibisect43all 3.5 is as far back as I can go.)

I already set it to OOo inherited so bibisecting was unnecessary.

> I disagree with comment 3 - the first two (empty) paragraphs are right
> aligned, and the rest or left aligned - same as always.

Yes that is the problem as the first two paragraphs are supposed to be left aligned and the rest are supposed to be right aligned, as Maxim mentioned in comment 1, similar to how it opens in MS Word.

> Comment 6 is a little misleading.  The first two paragraphs have XML that
> look like that - but those two paragraphs are also right-aligned. The
> remaining paragraphs (which are left aligned) all specify left alignment.

It was a typo and it should have said "which is supposed to be *left* aligned".
Comment 10 Justin L 2018-07-25 07:07:32 UTC
Created attachment 143744 [details]
pdf from word 2013 after ignoring the error message

This particular document had NO w:default=1, so that quickly broke ExchangeLeftRight which was improperly relying on FindDefaultStyle. All kinds of problems with the import code relating to this document, but things are fixed in 6.2.
Comment 11 Justin L 2018-07-25 07:13:48 UTC
Bibisect reports fixed in 6.2 by https://cgit.freedesktop.org/libreoffice/core/commit/?id=6b7f12f6108f136d60bd77e3787ef6a2632038cd

writerfilter: default style is the last one
Documentation states, and the examples confirm that
"If this attribute (w:default) is specified by multiple styles, then
the last instance of a style with this property shall be used."

Change-Id: I17f06ab8944a39341a00c479117e978a01d6af7a
Reviewed-on: https://gerrit.libreoffice.org/57510

I'd suggest not trying to backport this, since it relies on many other fixes. See bug 72560 and bug 106174.