We will be migrating from Ask to Discourse on the first week of August, read the details here

Ask Your Question

Paragraph spacing differs when opening DOCX

asked 2020-07-13 15:08:55 +0200

rominator gravatar image

updated 2020-07-27 15:29:54 +0200

Alex Kemp gravatar image

We are considering LO as a MS Word replacement and checking out the reproduction of existing DOCX documents. When opening a docx with a text frame the first paragraph of the frame gets a "Spacing / Abwove paragraph" of 0,42 cm whereas the source document in MS Word has not (0 pt).

I have attached a minimal anonymized document that is quite similiar to the source document for the sake of reproduction. C:\fakepath\Text Frame first paragraph.docx

You can easily see the difference in the options of the two programs too.

image description

My question is: How should I move forward with such problems. Is there a chance that this gets corrected in the DOCX import?

edit retag flag offensive close merge delete


My question is: How should I move forward with such problems

Very good question! You should report them.

Mike Kaganski gravatar imageMike Kaganski ( 2020-07-13 15:13:56 +0200 )edit

is there really a chance of getting this fixed? When searching only for paragraph spacing I get 206 open bugs beginning with 2015. I can't even check if this issue has already been reported in a reasonable time :-(

rominator gravatar imagerominator ( 2020-07-13 15:43:55 +0200 )edit

I can't even check if this issue has already been reported

Why would you want to spend time checking that? Just file a bug report.

And yes, there are many bugs. There are no guarantee that it would get fixed. Some bugs get fixed within hours (a great luck, but e.g. yesterday I fixed such a bug), some wait years.

Mike Kaganski gravatar imageMike Kaganski ( 2020-07-13 15:52:13 +0200 )edit

alright. thanks for your quick replies! https://bugs.documentfoundation.org/s...

rominator gravatar imagerominator ( 2020-07-13 15:53:30 +0200 )edit

And just to be sure I did not mean to step on anybodies toe about the bug fixing time! Sorry for that if I hurt your developer pride. (Coming from one developer to the other)

rominator gravatar imagerominator ( 2020-07-13 16:05:17 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2020-07-13 15:55:18 +0200

ajlittoz gravatar image

updated 2020-07-13 15:55:52 +0200

You're the one to blame (or rather the author of this document).

First remark: the outline rectangle with the fish picture is not a frame but some drawing object like a rectangle or text box. It has not the same properties as a frame and you'll meet many compatibility problems if your documents are stuffed with such graphics objects instead of true text frames.

Now to the heart of the problem.

The first paragraph in the rectangle is styled Frame Contents as the rest of the text in this rectangle. Paragraph style Frame Contents has 0-spacing above and below. But, someone added manually a 0,42cm-above and 0,21cm-below spacing. This is called direct formatting and reapplying the style won't erase it because added direct formatting takes precedence over style attributes.

This spacing is present in the original .docx.

The difference in rendering comes from a difference in behaviour between Word and Writer. Word deliberately ignores any spacing-above at top of page while Writer follows any paragraph settings, even if this may look unusual. This allows, among other effects, to offset chapter title down in the page to make it more prominent without using weird subterfuges.

This is a known difference and you can force Word compatibility in Tools>Options, LibreOffice Writer>Compatibility. There the third check box (in v6.4.4.2) read Add paragraph and table spacings at tops of pages. Uncheck this box and you'll get identical formatting.

To show the community your question has been answered, click the ✓ next to the correct answer, and "upvote" by clicking on the ^ arrow of any helpful answers. These are the mechanisms for communicating the quality of the Q&A on this site. Thanks!

In case you need clarification, edit your question (not an answer) or comment the relevant answer.

edit flag offensive delete link more


wow. Right between the eyes. Thank you!

rominator gravatar imagerominator ( 2020-07-13 16:30:08 +0200 )edit

But, someone added manually a 0,42cm-above and 0,21cm-below spacing

No, only 0,21cm-below. The OOXML does not have any "above":

    <w:spacing w:after="120"/>

It looks like we apply the contextual spacing in case of existing spacing-after, which shouldn't be in drawings: https://opengrok.libreoffice.org/xref/core/writerfilter/source/dmapper/DomainMapper.cxx?r=b216fc5b#428

Mike Kaganski gravatar imageMike Kaganski ( 2020-07-13 16:51:07 +0200 )edit

This is a little hard to follow for me now. I will probably have time to investigate this further later this year. For now I am using the recommended compatibility setting. I have seen some other problems that arise when using this compatibility setting. I will probably file report this issues separately.

rominator gravatar imagerominator ( 2020-07-16 08:16:35 +0200 )edit

@rominator: thank you for your effort! Every report makes LibreOffice better.

Mike Kaganski gravatar imageMike Kaganski ( 2020-07-16 09:52:02 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-07-13 15:08:55 +0200

Seen: 120 times

Last updated: Jul 13 '20