Page 1 of 1

docx2xhtml text direction

PostPosted: Wed Aug 14, 2013 5:06 am
by kwhite
When a docx is converted to xhtml containing a rtl language, the style "direction: rtl" is applied to the span tag, which is an inline element.
Therefore rendering the style useless. How to get this style in the parent p tag instead?

Re: docx2xhtml text direction

PostPosted: Thu Aug 15, 2013 5:41 pm
by jason
Could you please provide an example of an input docx (two short paragraphs would be fine) and your expected html output.

I tried the attached docx containing hebrew (which please note I do not speak) and the HTML generated by docx4j looked the same to me in Chrome as the input docx looked in Word 2010.

In both cases the words appeared on the screen ordered right to left.

Re: docx2xhtml text direction

PostPosted: Thu Aug 15, 2013 11:45 pm
by kwhite
Here is an arabic docx when converted to html becomes...

<p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="direction: rtl;">من الإنجليزية إلى العربية.</span></p>

<p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="direction: rtl;">هذا هو ملف عينة لاختبار الحق في التصميم اليسرى في HTML.</span></p>

<p class="Normal DocDefaults "><span class="DefaultParagraphFont " style="direction: rtl;"><span style="white-space:pre-wrap;">آمل أن يعمل هذا. </span></span></p>

If I add the style to the p tag, it works fine.

Re: docx2xhtml text direction

PostPosted: Thu Aug 15, 2013 11:58 pm
by kwhite
Oops, I attached the english by mistake.
This is the arabic version (please note I do not speak arabic, translation may be incorrect)

Re: docx2xhtml text direction

PostPosted: Fri Aug 16, 2013 10:35 pm
by jason
http://www.w3.org/International/article ... di-markup/ is a good explanation of the issues at hand.