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

LineSpacing and newlines

4 Answers 682 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Shaun
Top achievements
Rank 1
Shaun asked on 06 Feb 2015, 05:05 PM
Hi,

I am struggling to alter the linespacing on the telerik.windows.documents.fixed.model.Editing.Block. I use the following line of code;

textBlock1.LineSpacing = 10

However this doesn't seem to have any effect. Nothing crashes and there is no problems running the code. If I break at this line the value is never set. I can use the Visual Studio debugger to set the value and it works perfectly. Any ideas?

Secondly when using multiline text from a database the block doesn't seem to respect newlines. I have to use the following code which seems a bit excessive.
 
01.Private Sub InsertText(textBlock As Editing.Block, descriptionText As String)
02.           Dim ascii() As Byte = System.Text.Encoding.ASCII.GetBytes(descriptionText)
03.           For i As Integer = 0 To descriptionText.Length - 1
04.               If ascii(i) = 13 Then
05.                   textBlock.InsertLineBreak()
06.               Else
07.                   textBlock.InsertText(descriptionText(i))
08.               End If
09.           Next
10.       End Sub

Any help would be much appreciated.

Regards,

Shaun

4 Answers, 1 is accepted

Sort by
0
Shaun
Top achievements
Rank 1
answered on 09 Feb 2015, 02:33 PM
Please ignore the first part of this question. When continuing on with other parts of this document the line spacing has started to work. Unfortunately I am not sure when this was.  
0
Kammen
Telerik team
answered on 09 Feb 2015, 03:26 PM
Hi Shaun,

Thank you for the interest in RadPdfProcessing.

1. LineSpacing does not work correctly. For the official release at the end of the month we will redesign its behavior. The line spacing will work the same way as in RadWordsProcessing - 3 different states AtLeast, Exact and Auto that will affect the line spacing differently.

2. Currently the Block element does not break multiline text on lines. We will consider this feature request and maybe we will implement it for one of the future releases.

Hope this answers your questions.

Regards,
Kammen
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
René
Top achievements
Rank 1
answered on 26 Oct 2020, 08:33 AM

Since 5 and a half years later newlines are still ignored here a workaround in C#:

private void InsertTextWithNewlines(Block block, string text)
{
    string[] lines = text.Split(new[] {"\r\n", "\r", "\n"}, StringSplitOptions.None);

    for (int i = 0; i < lines.Length; i++)
    {
       block.InsertText(lines[i]);
       if (i < lines.Length - 1)
       {
          block.InsertLineBreak();
       }
    }
}

0
Dimitar
Telerik team
answered on 27 Oct 2020, 09:54 AM

Hi Rene,

Yes, unfortunately, this is still not implemented.

Thank you for sharing your solution. I can see that you have added a feature request for this on our portal. I want to share the link here as well so others can see it add their votes/comments to the item: Block.InsertText should not ignore newlines.

Do not hesitate to contact us if you have other questions.

Regards,
Dimitar
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
PdfProcessing
Asked by
Shaun
Top achievements
Rank 1
Answers by
Shaun
Top achievements
Rank 1
Kammen
Telerik team
René
Top achievements
Rank 1
Dimitar
Telerik team
Share this question
or