I try to convert a plain text in RTF-Format. Therefore, I use RichTextBox (WinForms).
The concerned method the RTF-Markup as string.
Now, I want to insert line spacing in the markup. I found that there are 2 parameters:
- \slX (Space between lines in twips)
- \slmultX (either 0 or 1)
If I set \slmult0
, the line spacing is above the line of text.
When I set \slmult1
, the line spacing is below the line of text.
I calculate the spacing in the following way:
(lineSpacing + fontSize)*20
When I switched from \slmult0
to \slmult1
, I determined, that the line distance is little smaller than with \slmult0
.
Does somebody know the reason for this behavior? Do I have to calculate with another formula?
Best Answer
If I set \slmult0, the line spacing is above the line of text. When I set \slmult1, the line spacing is below the line of text.
That is not what I read in the specs.
The way I understand it, it means that
\slmult0
says that the value of\slN
is to be used directly as a distance in some unit, whereas\slmult1
says theN
in\slN
is meant as a factor by which the regular line spacing is multiplied.See the last post here for (some) more details! (But there is also a note about it taking effect one line too late..)
Also do note the importance of the sign of
N
in the\slN
! (This was the reason of my comment above: The effect of, say\sl234
, will depend on the size of the tallest character in the line..!)Here is a nice discussion of some things RTF; a note about units:
and a clear definition of extra spacing before and after paragraphs:
Here are more direct instructions: