Justified text and forced line breaks in docx document

I want to migrate from MS Office to LibreOffice, but i have some problems with justify when im using force line breaks (shift+enter) in paragraph in docx documents and open them in LibreOffice Writer.
Incorrectly displayed end of the lines. In MS Office “word close” line, in LibreOffice “space close” line.
Example of the problem in the screenshot.
example
I will be glad to any ideas how to fix this.

Sorry, if you are a switcher, you will probably have to relearn some work techniques.
But don’t worry, you will be helped here.


First of all, when you work with LibreOffice Writer, you save exclusively in ODT format.
If you need to pass a DOCX to someone else, open your ODT and make a copy in DOXC with “Save as…”.


In order to make concrete statements about your problem, it would be useful if you upload your file here.

This is an interoperability bug. We have a compatibility option to treat trailing spaces as Word does (the option is active when opening any MS Word file format), but obviously it doesn’t take hard line breaks into account.

Please file it as a bug report.

Ah, it’s tdf#57187.

2 Likes

There a “logical” flaw in your docx document: you use two different separators between words, i.e. space + line break, instead of a single one. Personally, I don’t see the point of forcing line breaks versus letting Writer (or any other app) do the job.

If you really insist on forcing line breaks, use only one separator instead of a mixture of both.

To get your expected result, replace space+linebreak by linebreak.

The reason you get a ragged result comes from the fact you decided linebreaks while Writer would choose a space (in fact any continuous space sequence) as the line limit and remove them from text to justify. When line contents is determined, remaining distance is spread over the existing space characters. Since you have one space at end, this space is also expanded.

Same problem if you have space characters after the manual linebreak.

Though the internal algorithm could be “improved”, I think authors should avoid nonsensical sequences in their text. From my long experience with document processors, I have not yet felt the necessity for interfering with linewrap decision. Perhaps, you should explain your purpose so that we can propose a better solution. Note that if you change your margins, all your manual linebreaks sould be reviewed.

3 Likes