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

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

1 Answer 394 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Seth Lowrey
Top achievements
Rank 1
Seth Lowrey asked on 07 Jan 2011, 07:55 PM
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.

1 Answer, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Jan 2011, 06:58 PM
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,
Peter
the Telerik team
Get started with Telerik Reporting with numerous videos and detailed documentation.
Tags
General Discussions
Asked by
Seth Lowrey
Top achievements
Rank 1
Answers by
Peter
Telerik team
Share this question
or