Text field does not interpret "Tab" (ascii 9) character in string data

2 posts, 0 answers
  1. Seth Lowrey
    Seth Lowrey avatar
    4 posts
    Member since:
    May 2006

    Posted 07 Jan 2011 Link to this post

    I have a text field in a report we are using to display multi-line string data from a database that contains tab characters (ascii 9).  These are getting compressed to single spaces or just not getting displayed at all.  Is there any way to print text with tabs and have the report process the tabs correctly?  We tried the HTML control as well and not able to find an answer with it either, plus it does not process cr/lf either (have to replace those with <BR> tags), which the text field does correctly.  We are using Q2 2010 right now, not seeing anything in Q3 2010 that would give us any help with this.  We have many customers displeased because what they are expecting is not what they see on these reports. Thanks for any advice you can give.
  2. Peter
    Peter avatar
    1631 posts

    Posted 12 Jan 2011 Link to this post

    Hello Seth Lowrey,

    Browsers are trimming any additional spaces and this causes the unexpected behavior - check out the page source for the generated html in the Web Report Viewer. The HTML Rendering engine doesn't trim spaces and you can verify this in the generated HTML. Generally Tab character is a control character not a printable character. Check out the HTML ASCII Reference.

    HT &#09; horizontal tab

    However if you want to add a printable meaning to the tab control character you can replace it with a printable character of your choice with an User Function as shown in the following code snippet. Up to the new line behavior you have experienced we have suspicions that your issue is that you have used carriage return (chr(13)) as a new line - can you try using Environment.NewLine or vbCrLf instead and let us know of the outcome?

    public static object replaceTab(string value)
    	return value.Replace("\t", "    ").Replace(" ", "&nbsp;&#8203;").Replace("\r",Environment.NewLine);
    All the best,
    the Telerik team
    Get started with Telerik Reporting with numerous videos and detailed documentation.
Back to Top