Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MigraDoc: How to apply vertical line spacing to a paragraph?

I am creating a PDF using MigraDoc. Everything works fine except the setting of line spacing of a paragraph. I want to have more vertical space between paragraph lines.

What I tried so far without any change in the resulting PDF:

string text = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.";

Paragraph para = CreateParagraph(text , "Helvetica", 7, "0.1mm", Colors.Black, ParagraphAlignment.Left);

// tried this:
para.Format.LineSpacing = MigraDoc.DocumentObjectModel.Unit.FromMillimeter(12);

// and tried that:
para.Format.LineSpacing = 12;

Can anyone point me in the right direction?

like image 448
Thariama Avatar asked Nov 23 '17 10:11

Thariama


People also ask

Is the vertical space between lines of text in a paragraph?

Line spacing determines the amount of vertical space between lines of text in a paragraph. By default, lines are single-spaced, meaning that the spacing accommodates the largest font in that line, plus a small amount of extra space. Paragraph spacing determines the amount of space above or below a paragraph.

Is the vertical spacing before and after a paragraph?

It is false that, line spacing is the vertical space before and after a paragraph. There are two types of vertical spacing adjustments in most of recent word typing softwares (eg. MS Word). Those two types of vertical spacing are - 1) line spacing and 2) paragraph spacing.


Video Answer


1 Answers

The meaning of LineSpacing depends on the value set for LineSpacingRule.

If LineSpacingRule is set to e.g. Single or Double then the value set for LineSpacing will be ignored.

Try AtLeast or Exactly for LineSpacingRule.

like image 50
I liked the old Stack Overflow Avatar answered Oct 19 '22 14:10

I liked the old Stack Overflow