This is a migrated thread and some comments may be shown as answers.

RadrichTextBox line spacing

4 Answers 643 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
vikas
Top achievements
Rank 1
vikas asked on 30 Jul 2014, 10:40 AM
Hi,
I am using the below code for RadRichTextBox. The linespacine between lines of text is 1. I want the line spacing to be 0. Can you please have a look and advise.

 <telerik:RadRichTextBox HorizontalAlignment="Left" LayoutMode="Flow" AcceptsTab="False" IsSpellCheckingEnabled="False" IsContextMenuEnabled="False" IsSelectionMiniToolBarEnabled="False"
                                    DocumentInheritsDefaultStyleSettings="True"  GotFocus="TxtLeftHeaderBox_OnGotFocus" Visibility="{Binding HeaderVisibility}" Width="175" Height="125" Margin="5">
                <telerik:RadRichTextBox.Document>
                    <telerik:RadDocument LineSpacing="0" LineSpacingType="Auto" >
                        <telerik:Section>
                            <telerik:Paragraph FontSize="10" LineSpacing="0" LineSpacingType="Auto" >
                                <telerik:Span FontFamily="Arial" Text=" "  FontSize="10" />
                            </telerik:Paragraph>
                        </telerik:Section>
                    </telerik:RadDocument>
                </telerik:RadRichTextBox.Document>
            </telerik:RadRichTextBox>

Regards,
vikas

4 Answers, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 04 Aug 2014, 07:52 AM
Hello vikas,

If you want to set the line spacing property of a paragraph to 0 you can set the LineSpacingType to Exact and the LineSpacing to 0. However, please note that line spacing value 1 is the equivalent of no spacing between lines, whereas 0 (or any value smaller than 1 actually) would force the lines in the paragraph to overlap one another.

I hope this is useful.

Regards,
Petya
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Jeffrey
Top achievements
Rank 1
answered on 25 Jun 2019, 12:07 AM

I've searched all the posts related to the RadRichTextBox line spacing but I still don't understand how to change it.

I simply want to the user input to be like this:

Line1
Line2
Line3

Instead of the default of:

Line1

Line2

Line3

For a regular RichTextBox this works and there is no double spacing in the RichTextBox:

<<RichTextBox Grid.Column="1" Grid.Row="2" x:Name="RadRichTextBoxLabwareSoap" HorizontalScrollBarVisibility="Auto" Margin="0,10,0,10" VerticalScrollBarVisibility="Auto" Background="#FF2C2C2C" Foreground="#FFBFBFBF">
    <RichTextBox.Resources>
        <Style TargetType="{x:Type Paragraph}">
            <Setter Property="Margin" Value="0"/>
        </Style>
    </RichTextBox.Resources>
</RichTextBox>


What is the equivalent of this for a RadRichTextBox?

0
Tanya
Telerik team
answered on 26 Jun 2019, 09:12 AM
Hello Jeffrey,

The line spacing of the paragraphs inside a document is determined by the style applied to the content. You can obtain the Normal style through the StyleRepository property of RadDocument as demonstrated in Example 8 of the Styles help topic.

Hope this is helpful.

Regards,
Tanya
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Patrick
Top achievements
Rank 1
commented on 22 Jul 2024, 07:13 PM

This does nothing for the default style of my radRichTextbox. Spacing after is still set to 9 with line spacing still being multiple set to 1.15.
0
Rae Ok
Top achievements
Rank 1
answered on 01 Dec 2019, 02:54 AM

StyleDefinition normalStyle = radRichTextBox1.Document.StyleRepository[RadDocumentDefaultStyles.NormalStyleName];

 normalStyle.ParagraphProperties.AutomaticSpacingAfter = false;
 normalStyle.ParagraphProperties.SpacingAfter = 0;

Patrick
Top achievements
Rank 1
commented on 22 Jul 2024, 07:13 PM

This does nothing for the style of my radRichTextbox. Spacing after is still set to 9 with line spacing still being multiple set to 1.15.
Dimitar
Telerik team
commented on 23 Jul 2024, 05:36 AM

Hi Patrick,

This can be related to the specific document and the styles in it. I would recommend submitting a new ticket and attaching the document there. This will allow us to properly investigate why this is not working in your case. 

Thank you in advance for your patience and cooperation. 

Tags
RichTextBox
Asked by
vikas
Top achievements
Rank 1
Answers by
Petya
Telerik team
Jeffrey
Top achievements
Rank 1
Tanya
Telerik team
Rae Ok
Top achievements
Rank 1
Share this question
or