Bug 43093 - FILEOPEN: [docx] MS Office documents opens with wrong alignment and directionality
Summary: FILEOPEN: [docx] MS Office documents opens with wrong alignment and direction...
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
3.4.4 release
Hardware: All All
: medium normal
Assignee: Faisal Menawer
URL:
Whiteboard: BSA target:4.2.0
Keywords:
Depends on:
Blocks: RTL-CTL 71646
  Show dependency treegraph
 
Reported: 2011-11-19 07:29 UTC by Munzir Taha
Modified: 2016-08-20 04:09 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
two Arabic words and two Engish words aligned differently (12.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2011-11-19 07:29 UTC, Munzir Taha
Details
sample text in different alignment and directionality (12.66 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2011-12-27 07:05 UTC, Munzir Taha
Details
a print screen of how the document looks in MS Office (225.80 KB, image/png)
2011-12-27 07:08 UTC, Munzir Taha
Details
a print screen of how the document looks in libreoffice (71.85 KB, image/png)
2011-12-27 07:25 UTC, Munzir Taha
Details
a print screen of how the document looks in libreoffice 4.1.0RC3 (38.49 KB, image/png)
2013-07-21 10:27 UTC, Lior Kaplan
Details
MS test file with LTR locale (9.21 KB, application/vnd.ms-word.document.12)
2013-07-22 15:10 UTC, Faisal Menawer
Details
docx with LTR and left aligned (Created using Word 2010 SP2) (14.69 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-11-13 16:41 UTC, Maxim Monastirsky
Details
LTR left aligned save bug (22.26 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2013-11-14 13:23 UTC, Maxim Monastirsky
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Munzir Taha 2011-11-19 07:29:40 UTC
Created attachment 53690 [details]
two Arabic words and two Engish words aligned differently

Problem description: 
I created a small document with MS Office 2010 with words aligned to the right and others aligned to the left. When I opened that document with LibreOffice, all words are aligned to the right.
Steps to reproduce:
1. Create a MS Office document with 2 Arabic word and two English words each in
its own line
2. Align each language words in the two directions
3. Save and open in LibO

Current behavior:
All words aligned to the right.

Expected behavior:
Words aligned to the left in MS Office 2010 should appear as aligned to the left in LibO

Platform (if different from the browser): 
              
Browser: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.2 (KHTML, like Gecko) Ubuntu/11.10 Chromium/15.0.874.106 Chrome/15.0.874.106 Safari/535.2
Comment 1 Lior Kaplan 2011-12-26 12:08:42 UTC
Please add a screen shot of the document in Word. Also - did you define the document to be RTL or that is something LibO decided during import.
Comment 2 Munzir Taha 2011-12-27 07:05:38 UTC
Created attachment 54851 [details]
sample text in different alignment and directionality

The bug is a generic bug and not specific to Arabic or RTL, so I made a new attachment to help clarify the problem
Comment 3 Munzir Taha 2011-12-27 07:08:38 UTC
Created attachment 54853 [details]
a print screen of how the document looks in MS Office
Comment 4 Munzir Taha 2011-12-27 07:25:25 UTC
Created attachment 54855 [details]
a print screen of how the document looks in libreoffice
Comment 5 Munzir Taha 2011-12-27 07:29:40 UTC
@kaplan:
Screen shots attached. Libo decided about the alignment and directionality and I didn't change any thing on it.
Comment 6 Christian Lohmaier 2011-12-28 07:22:55 UTC
confirmed, when opened in 3.5.0beta2, the whole document is right-aligned.
Comment 7 amirimobile 2012-06-16 04:14:17 UTC
The same issue occurs with embedded pictures: what should be aligned to the left is instead aligned to right. Would this be related, or a different bug?
Comment 8 Lior Kaplan 2013-05-22 21:09:59 UTC
Commit becb244b4974609b0570e8db27d74e7e1179181c seems to be related. With LTR locale it makes the first and last lines for the test doc to be aligned left (while the wanted result is second and last). With RTL locale there's not difference.
Comment 9 Commit Notification 2013-06-16 10:31:34 UTC
Faisal M. Al-Otaibi committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=e9911f12d1e124d1910ac2310c224e66ab365ed4

docx: fdo#43093 fdo#44029 fix the alignment when the paragraph are RTL



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.
Comment 10 Lior Kaplan 2013-07-21 10:27:16 UTC
Created attachment 82765 [details]
a print screen of how the document looks in libreoffice 4.1.0RC3

The testdoc looks different (not better) in 4.1.0rc3 and master. Commit e9911f12d1e124d1910ac2310c224e66ab365ed4 isn't part of 4.1.0, so I'm not sure what the effect of that commit when opening the testdoc.
Comment 11 Faisal Menawer 2013-07-22 15:10:30 UTC
Created attachment 82822 [details]
MS test file with LTR locale

the patch fix the bug in this file.

hmm
there a problem if the file created with RTL locale in MS.
libreoffice can't know what is the default values.
Comment 12 Commit Notification 2013-10-07 08:12:06 UTC
Faisal M. Al-Otaibi committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=aa52753785154f0e95fed559f613f5eae9105dcf

DOCX:fdo#43093 fix wrong direction and alignment for RTL



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.
Comment 13 Ahmad Harthi 2013-10-07 08:14:45 UTC
Please test the latest patch heavily.. this will fix many of the RTL docx issues!
Comment 14 Maxim Monastirsky 2013-11-13 16:41:01 UTC
Created attachment 89156 [details]
docx with LTR and left aligned (Created using Word 2010 SP2)

I can confirm that attachment 82822 [details] (MS-test.docx) opens correctly. Tested with both RTL\LTR locales. Build ID: bd7a4db1dc4e4785956e81f0f997257063669709, Fedora 19 (64-bit).

I can also confirm it with my own files, except one combination: LTR text with left alignment. It opens correctly with LTR locale, but with RTL locale it opens as LTR but *right* aligned. I'm attaching the affected file, which was created using Word 2010 SP2.
Comment 15 Commit Notification 2013-11-13 19:47:04 UTC
Faisal M. Al-Otaibi committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3f9e7e72c53ecbe8ee1ab060f811cb41eadfc7e1

DOCX: fdo#43093 set alignment if not already set



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.
Comment 16 Faisal Menawer 2013-11-13 19:53:38 UTC
hi, @Maxim
nice test i didn't notice it before.
i think it is ok now.
Comment 17 Maxim Monastirsky 2013-11-14 13:23:07 UTC
Created attachment 89190 [details]
LTR left aligned save bug

(In reply to comment #16)
> hi, @Maxim
> nice test i didn't notice it before.
> i think it is ok now.
Indeed, it's OK with Build ID: f50699c816de8e4be3433c6387e37d92aedd41a0. Thanks.

Also I've tested both opening and saving functionality with many docx files from different sources, and it looks very good so far.

But I found one uncovered case: It's a file originally created using Word 2013, and contains LTR left aligned text. It opens fine using the above LO build, but if I save again and reopen, it turns into RTL left aligned. If then I open the file with Word 2010 SP2, it opens as RTL right aligned. It's a bug only with this file, I can't reproduce it with other files.

(The attached file edited by me using Word 2010 SP2, but the same bug happens with the original file from Word 2013.)
Comment 18 retired 2013-11-14 14:40:49 UTC
Since this is a very old bug and many issues at hand have been discussed here should the patches be merged and new bugs filed for the remaining issues?
Comment 19 retired 2013-11-14 14:41:23 UTC
Setting to Assigned since Faisal is assigned in the top info and also working on this.
Comment 20 retired 2013-11-14 14:41:31 UTC Comment hidden (obsolete)
Comment 21 Faisal Menawer 2013-11-15 14:19:13 UTC
i opened another Bug 71646 for the saving problem; because this
bug are about opening problem.
Comment 22 Faisal Menawer 2013-11-18 17:27:50 UTC
changed the status after fixing all the related issues.
Comment 23 Lior Kaplan 2014-06-04 22:17:44 UTC
Marking as verified (testing with 4.2.4 on Debian).