Apache OpenOffice (AOO) Bugzilla – Issue 38158
RTL table imported with columns reversed
Last modified: 2013-08-07 14:42:56 UTC
The attached Word file contains an RTL table. After import, the columns are reversed, row height is too small, some lines are doubled, cells which should be in the same column are not.
Created attachment 19928 [details] The problem file
Created attachment 19929 [details] Screen shot of the file as it appears in Word
Created attachment 19930 [details] Screen shot of the file as it appears in OOo
MRU->MMAHER: the content of the columns is in reversed order after import. Also the structure of the complex table is wrong. Maybe this both problems are succeeding errors of each other.
When the problem file is loaded into Word 2000 (Hebrew version), then saved under a different name, OOo m69 reads the table correctly (though the grid disappears). When the problem file is loaded into Word 2002 , then saved under a different name, OOo m69 reads the table with the columns reversed. This may provide you with a clue for fixing this bug. I'm attaching the file which was saved under Word 2000 Hebrew version (the one which OOo read correctly).
Created attachment 21400 [details] Problem file resaved by Word 2000 Hebrew version
This is a regression bug. The file is imported correctly in 1.1.4.
This is a regression bug. The file (TableTest4.doc) is imported correctly in 1.1.4.
ayaniger -> mmaher Have you had the time to work on this issue? This is a very visible bug for Hebrew users, and I'd like to look into it myself. Where in the code is the adjustment of column order for RTL tables? Thanks.
mmaher: reassigning to flr. I am no longer responsible for filters.
If you run "Convert table to text" in the sample document TableTest4, the text is displayed correctly, from right to left. If you then convert that text back to a table, the table is displayed properly.
Tested document "2003-2Horaa.doc" (attached) on Beta2.0 version 1.9m79 from date 5.3.05 on Linux. The results are that the tables aligned Right-to-Left in the original word document are imported into OOo with the columns reveresed. Tables aligned Left-to-Right in Word are imported ok into OOo.
Created attachment 23409 [details] Word doc with tables
ayaniger->flr: This problem seems to stem from a fix for a problem with vertical text, described in issue 25071. In the course of the fix, code was added which set the frame direction without taking right-to-left tables into account. I'm attaching a patch to fix this oversight. When I tested it, the documents attached to this issue were imported with columns in the correct order. The same goes for the test document in Issue 31313. To make sure I didn't break the fix to Issue 25071, I also tried importing the test documents with vertical text attached to Issue 25071, and there was no change. RTL documents with tables containing vertical text were also imported correctly. It seems to me that this patch fixes the problem. Could you take a look and send me your comments? It would be great if we could have a fix for this issue in the final 2.0 version.
Created attachment 23762 [details] Proposed patch to fix the ordering of columns in RTL tables
*** Issue 50877 has been marked as a duplicate of this issue. ***
*** Issue 51618 has been marked as a duplicate of this issue. ***
*** Issue 52427 has been marked as a duplicate of this issue. ***
A patch was available for more than half a year. Whom do we address to get it checked in?
ayaniger->flr: I have integrated this patch into our Hebrew builds of OOo, which have been used for about a year and a half now. Can you review this patch, so it can be integrated into the source tree? Thanks.
fme->flr: I'll take over if you don't mind ;-) fme->ayaniger: Thank you for the patch, I'll have a look. I changed the target to the next OOo release.
FME: Analysis: The problem is caused by setting the table direction to RTL but the cell direction to LTR. FME->ayaniger: I'm not sure if we should set the table cell direction to RTL (in case bIsBiDi is set), or if we should better set it to ENVIRONMENT (or if we should not set it at all, which has the same effect). Both works fine, but if we set the cell direction to RTL, there are two minor problems: 1. the ui (table properties - text flow - text direction) will show an empty list box for the cell direction. 2. switching the table direction to from RTL to LTR does not work correctly, since this results in a table with different directions for the table and the contained cells. Anyway, since setting the cell direction to RTL has already been tested in your own builds and it definitely makes the import better than it is right now, I'll integrate the patch. Thank's again for your contribution! FME: One more remark: The table in the document TableTest200Heb.doc will be imported as a LTR table, although it is RTL in Word. However, the layout looks fine, only the cell names and tab travelling are reversed. For some myterious reasons this problem vanishes, if I save this file again with Word. FME: Fixed in cws swqbf86, ww8par2.cxx rev. 1.122.32.2
*** Issue 31313 has been marked as a duplicate of this issue. ***
FME: Ready for QA.
Verified fix in CWS swqbf86.
Checked fix in OO 2.1 release build.