Geeks With Blogs

News Locations of visitors to this page
The Out Campaign: Scarlet Letter of Atheism

Disclaimer
The content of this site are my own personal opinions and do not represent my employer's/Microsoft view in anyway. In addition, my thoughts and opinions often change, and as a weblog is intended to provide a semi-permanent point in time snapshot you should not consider out of date posts to reflect my current thoughts and opinions

About
Suresh Veeragoni, working as a Principal Consultant at Sogeti USA LLC (A subsidiary of Capgemini SA Group), developing SOA & BPM solutions for Businesses using Microsoft CSD products (BizTalk, WF, WCF etc)

My Company

Sogeti




QR-Code for my Blog

qrcode

Suresh Veeragoni's Blog A BizTalker's Blog

Consider you have a SQL Server Table with some multiline text data. And that data contains carriage return in it.

Now, if you want to display that data with carriage return in SSRS 2005 textbox, there is no direct way to display it.

Because SSRS 2005 uses VB engine to render the data, where it doesn’t understand line feed-->CHR(10) or Carriage Return -->CHR(13) characters.

So, what is the alternative?

Well, simple we need to use the Replace() function available and replace the specific characters with VbCrLf

 

ex:

=Replace(First(Fields!YourField.Value, "DataSource"),CHR(10),VbCrLf) –>This worked for me.

or

=Replace(First(Fields!YourField.Value, "DataSource"),CHR(13),VbCrLf)

 

In my case, The user was entering the data into SQL Server Database from an InfoPath form and wanted the carriage return to be persisted in the report. And in this case, CHR(10) worked instead of CHR(13).

Good to see SSRS 2008 added lot of rich text functionality, where you don't have to deal with these kind of silly things..,

Happy Reporting!

Posted on Wednesday, April 15, 2009 2:40 AM SSRS | Back to top


Comments on this post: Adding Carriage Return functionality to Textbox in SSRS 2005

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Left by Linda on May 07, 2009 10:15 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Wow, was just I was searching for!

Thank you very much!
Left by Kenny on May 28, 2009 3:29 PM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Thanks a lot This solved a lot for me
Left by TK on Jul 31, 2009 12:51 PM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Worked a treat
Left by SL on Aug 24, 2009 6:02 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Hi there,

I used this on one of my textboxes but it adds line breaks for all my textboxes for some reason... any idea why?
Left by Mel on Oct 20, 2009 9:06 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Mel,
What exactly you are looking for?
carriage return or line break?

check the wiki for hex equivalent of both line feed/newline and carriage return. either of one should work

http://en.wikipedia.org/wiki/Newline
Left by suresh on Oct 21, 2009 1:30 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
hecks ya! thanks mucho!
Left by ernesto on Dec 08, 2009 6:48 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Got the same problem in Visual Studio 2010 working with the newest Local Reporting(2008 R2).

Guess what this problem still exists.

But your posting helped me fixing it. Thank you big time!
Left by max on Jul 22, 2010 2:00 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Hi ,
How ro handle this into while export to excel from report .
while Export to excel ,its shows into single line .
how to split it up into two lines while Export
Left by ELAYA on Nov 11, 2011 1:20 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Thanks, I have found it in no time...
Left by Farhan Munir on Oct 15, 2012 11:18 PM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Great, but how to physically add a real line feed (or carriage return) into the textbox, in design mode?
Left by TecNQ on Jun 18, 2013 12:29 PM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
="" & replace(Fields!XYZ.Value,"|", "<br>") & ""
Left by Abhisek on Feb 17, 2015 3:05 AM

# solution
Requesting Gravatar...
Try like the

="" & replace(Fields!XYZ.Value,"|", "<br>") & ""
Left by Abhisek on Feb 17, 2015 3:05 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
You are an absolute life saver. This was just the bit of info I was looking for to complete a report. Thanks you.
Left by Tim on Mar 19, 2015 2:11 AM

# re: Adding Carriage Return functionality to Textbox in SSRS 2005
Requesting Gravatar...
Thanks a lot This solved a lot for me
I used html
=Replace(First(Fields!YourField.Value, "DataSource"),CHR(10),"<br/>")
Left by Seifemichiale on Feb 14, 2017 5:23 AM

Your comment:
 (will show your gravatar)


Copyright © microsoftian | Powered by: GeeksWithBlogs.net