ParagraphFormat line spacing returns wrong value

Hi,


I’m seeing paragraphFormat.getLineSpacing() return 13.8 (12 *1.15) for quite a few paragraphs when the font size is not 12pt. The attached document contains a paragraph the text of which is set to 72pt. I would expect getLineSpacing() to return 82.8 plus a bit (72 plus a bit * 1.15).

Cheers,
Simon

Hi Simon,

Thanks for your inquiry. You are getting the correct value of Line Spacing. The line spacing is the space between each line in a paragraph and one line is equal to 12 points (13.8 = 12 *1.15). The Multiple line spacing is specified in the LineSpacing property as the number of lines.

Please let us know if you have any more queries.

Tahir,


If line spacing is the distance between each line. Why when setting it to exactly 12pt does the top and bottom of the text get truncated as seen in the attached document?

Cheers,
Simon

Hi Simon,

Thanks for your inquiry.
In your recent document, the line spacing is Exactly (12 pt). This option sets fixed line spacing, expressed in points. For example, if the text is in a 10-point font, you can specify 12 points as the line spacing.

In your document (shared in your first post), the line spacing is Multiple. This option sets line spacing that can be expressed in numbers greater than 1. For example, setting line spacing to 1.15 will increase the space by 15 percent (13.8 = 12 *1.15), and setting line spacing to 3 increases the space by 300 percent (triple spacing).

I suggest you please read the detail of line space options from here:
https://support.office.com/en-in/article/Adjust-the-line-spacing-between-text-or-paragraphs-76647c60-de75-4a2c-95eb-aa9369530ff3

Please let us know if you have any more queries.

Tahir,


Thanks for the link. I realise my mistake, I’ve been trying to convert the LineSpacingRule and LineSpacing into a point value for use with a CSS line-height property.

I knew that I couldn’t do an At Least rule as there is no mapping.

Exactly is easy.

For Multiple, my mistake was trying to get a point value for line-height. I’ve realised that using 12 as a points per line value, I get a better result by dividing LineSpacing by 12 and using the resultant value as a multiplier. (Which is based on font size). This gives me a good enough result.
Thanks for you help and patience,
Simon

Hi Simon,

Thanks for your inquiry. It is nice to hear from you that you have solved your issue. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.