Line break issue in multi line text boxes

4 posts, 0 answers
  1. Chris Ward
    Chris Ward avatar
    52 posts
    Member since:
    Jan 2010

    Posted 27 Jan 2011 Link to this post


    I have a multiline text box that I am filling with data from my SQL Server.  The contents of this field contain paragraphs of text with line breaks.  When I preview the report or run the project and view in the "Report Viewer" the line breaks are not shown.  If I look at the HtmlPreview I do see the line breaks as expected.  If I display the contents of the text box to the debugger using System.Diagnostics.Debug.Print I can see the linebreaks fine in the output window. If I export the report to PDF, I also see the line breaks. 

    So it seems that the data is good but I have problems when viewing the the report viewer or preview mode.  Any suggestions on what may be going on here?


  2. Michael Salzlechner
    Michael Salzlechner avatar
    41 posts
    Member since:
    Jan 2010

    Posted 27 Jan 2011 Link to this post

    I am having a similar issue. Hard linebreaks do not work in the preview. Soft line breaks do work in the preview but do not in the report itself. When i add a subreport above the multi line text it suddenly shows soft and hard line breaks properly but doesnt push other textboxes down any longer and overlaps all the text
  3. Peter
    Peter avatar
    1629 posts

    Posted 28 Jan 2011 Link to this post

    Hi guys,

    @ Chris: Did you use a Carriage Return (\r) as new line character. If this is the case, then because Telerik Reporting and Silverlight are only able to handle line feed (\n) and \r\n as a new line character my suggesting is to use a replace method to manage the unexpected behavior. For example with the following User Function:

    public static object ReplaceCarriageReturn(string value)
        return value.Replace("\r", "\r\n");

    @Michael: we will need a sample project, so we suggest to continue the discussion in the support thread you've opened.

    the Telerik team
    Get started with Telerik Reporting with numerous videos and detailed documentation.
  4. Ryan
    Ryan avatar
    2 posts
    Member since:
    Oct 2010

    Posted 04 Jul 2011 Link to this post

    the official support was on the right track but did not work for me. Im using vb, but I needed to do an additional find / replace to make it work from the database, my userfunction is as follows:

    Public Shared Function MultilineHack(data As String) As String
    data = data.Replace("\r", "\r\n")
    data = data.Replace(vbCr, vbCrLf)
    Return data
    End Function

    Another hot tip, if you haven't discovered user functions, have a look at the link in the telerik admin post, they are way easy, and you can access them through the expression editor once you have built the project.

Back to Top