Line spacing 80% + image Anchor as character = upper part of image become white (or negative Leading?)

I am trying to mitigate from Microsoft 2016 to LibreOffice ( - Windows 7.
So far, I found only one incompatibility issue - image layout with proportional line spacing.


In Microsoft, if I set Line Spacing= multiple 0.8 on the line that has image “in line with text”, the result will be:-
image description

The chopped green circle show how much the upper part of image is lost.


In Libre, if I set Line Spacing= proportional of 80% on the line that has image “Anchor : as character” ,
the result will be:-
image description


Microsoft seems to calculate
lineHeight = imageHeight - (1 - 0.8)*fontSize ,
while LibreOffice calculate lineHeight = imageHeight*0.8.
Thus, in LibreOffice, more of the upper part of image is lost.

I believe LibreOffice’s formula is more intuitive, but unfortunately, I have a few 300+ pages document (with a lot of images) to reformat.

How to port the documents to LibreOffice effectively?

More information :-

  • Format of my documents are based on Styles.
  • Almost every line is proportional 80%, and I don’t want to change it to 100%.

#My poor solution (not work)
I found that line-space Leading is almost what I want, except that LibreOffice enforce it to always positive number.

I tried to unzip .odt, and edit the line-spacing in styles.xml to a negative number, but it crashed LibreOffice.

<style:style style:name="MyFormat2" style:display-name="MyFormat2" style:family="paragraph" style:parent-style-name="Standard" style:default-outline-level=""><style:paragraph-properties  .... style:line-spacing="-0.5cm"

Crash : Unfortunately it seems that LibreOffice crashed when it was last run.

Select each image (or via editing the content.xml file) and change top Spacing, and top Crop by keeping image size. You must calculate how many is 80% of the line height.

image description

Result of comparing original image and with 1 cm of spacing and crop:

image description

Tested with LibreOffice (x64); OS: Windows 10.0.

Add Answer is reserved for solutions. If you think the answer is not satisfactory, add a comment below, or click edit (below your question) to add more information. Thanks.

Check the mark (Answer markCorrect answer mark) to the left of the answer that solves your question.

If the answer helped you, you can mark the up arrow (Upvote mark) that is on the left (to vote, you need to have karma of at least 5).

If I understand right your requirement, you want to keep your image uncropped while simultaneously allowing the paragraph leading to remain what it is in absence of the image. In other words, you want the line spacing to adapt only for the line where the huge “character” is inserted, like in:

image without crop

Note that I changed line spacing to 80% to have a more compact text.

The trick is to note that every image is inserted in a frame styled Graphics. Right click on this style name in the style side pane and Modify. Go to the Wrap tab.

Here increase Top Spacing until the image no longer covers the preceding line. A distance of 0.5 cm seems to be correct.

Since you modify the frame style, all images are simultaneously fixed. Unless, of course, you direct formatted some of them.

This answers your basic question. However, IMHO, the choice of As character anchor is faulty because your image does not look like a super-huge character part of paragraph text (at least in your example).
If your image is an illustration accompanying paragraph text, a much better anchor is To paragraph which offers more positioning possibilities. And wrap options allow you to flow the text around it without creating huge gaps like in my screen shot above.

As an example, see how the image can be positioned in the middle of the paragraph with justification around (the is ugly but it is an example of the change of the anchor mode):

image in the middle

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 which is reserved for solutions) or comment the relevant answer.