2

I use LibreOffice on Linux and sometimes have to proofread .docx files for a friend. These files are written in German, but they are created on a Windows computer where the default setting is Arabic. They are also formatted in an untolerable way (on the lines of all bold and 20 pt).

The following does not depend on whether I first convert the .docx to .odt or not.

In the document as I receive it, the formatting is garbage, but the text flow is actually correct. When I select all text and click Clear formatting, the text flow is changed to right-to-left, and periods go to the left as well.

++++++++. This is how it looks
This is how it should look.++++

I assumed this was because the document language is Arabic, so I tried to change the document’s language from the status bar, but that only affects spellchecking. Then I wanted to change the language to German or English in Options → Language Settings → Languages, but it was already set to German!

However, it says in Format → Page → Organizer:

Contains: … + Text direction right-to-left (horizontal) + Page description: Arabic …

I do not know why these settings are there, as they are not set in the options.

It’s possible to manually change the text flow to left-to-right in Format → paragraph → Alignment, but this is very superficial: pressing the end key will position the cursor on the (left) beginning of the line, while the pos1 key will position it on the (right) end of the line. Also, choosing Clear formatting afterwards reverts this manual setting.

The only way to fix these formatting issues seems to be to first save the document as a .txt file to lose all meta information, then reopen it and save it as .odt. This can’t be the only way, though.

How can I really change the document’s language?


I looked for answers on www.ask.libreoffice.org but couldn’t find a solution there. These links are on similar topics, but didn’t provide a working solution to this case:

https://ask.libreoffice.org/en/question/7269/how-to-change-language-in-whole-document/

https://ask.libreoffice.org/en/question/15206/how-do-i-get-translated-caption-categories/?answer=15224#post-id-15224

https://help.libreoffice.org/Common/Selecting_the_Document_Language

2

First thing first: Language has nothing to do with your plight. You must look for something called "Text direction". Arabic and Persian are by mistake called "Right-to-left languages" but they are in fact "Bi-directional languages".

The easy way

Note: The instructions in this section apply to Microsoft Word 2016, but LibreOffice has their equivalents.

You must edit the "Normal" style of the document and change the text direction from "Right-to-left" to "Left-to-right". This is the style that gets enforced when you click on "Clear Formatting". (In some rare cases, "Normal (web)" gets enforced.) After that, select the whole document, open the Paragraph formatting dialog box and set direction to Left-to-Right.

If the direction radio buttons are unavailable, you have to open Language Settings and add a right-to-left language. (You don't have to install their OCR modules or spell checking dictionaries.)

To tame the lion

Now, there is a frightening part too: Sometimes, I receive documents from unknown origins that for some reason, cause the Direction radio buttons to be grayed out! In this case, I use 7-zip to peak into the document and edit style.xml in Visual Studio Code. Here is the part for Normal style:

<w:style w:type="paragraph" w:default="1" w:styleId="Normal">
    <w:name w:val="Normal"/>
    <w:qFormat/>
    <w:rsid w:val="00702EFB"/>
    <w:pPr>
        <w:bidi/>
    </w:pPr>
</w:style>

Do you see the <w:bidi/> part? Deleting it causes the direction to switch back to LTR.

If you are bold enough, you can actually let GREP lose on the extracted contents of your .docx file eliminate all instance of <w:bidi/> in it. As long as you keep a backup copy, you have nothing to lose.

  • Thank you, changing the normal style did work! In the description of the document, it still says Arabic, so I looked inside the .odt file’s styles.xml, and it really does contain: style:language-complex="ar" style:country-complex="SA" – Philipp Jun 11 '18 at 8:21
  • Oh, thanks God! :) Glad to see hours and hours suffering from the misery of wrestling with badly formatted document helped someone. – user477799 Jun 11 '18 at 8:22
  • Rest assured that your answer will help future proofreaders and sufferers as well. +10 Karma points. – Philipp Jun 11 '18 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.