Replacing Carriage Return or New Line Characters in SSRS

By David Boll | March 10, 2015

Text formatting inside of a SSRS textbox can sometimes be tricky and this case is no exception. At the core we are using the built in REPLACE function. REPLACE takes the following parameters:

1) The string to search in (usually your field value)
2) What to search for
3) What to replace it with

There are some other optional parameters as well, but we aren’t going to focus on those. So where this becomes tricky is in the “what to search for”. You may think that you can search for “\r\n”, but that would be incorrect. What is needed is the CHR function. CHR(10) in particular. If you head out to http://www.asciitable.com/ you will see that character 10 is the new line character. Which makes sense for our search.

What you will end up with is something that looks like the following:

=REPLACE(<string to search in>, CHR(10), <string to replace with>)

If this still doesn’t get you the desired result, you may need to wrap the replace with another replace. This time you will be searching for CHR(13) (carriage return).

=REPLACE(REPLACE(<string to search in>, CHR(13), “”), CHR(10), <string to replace with>)


Under the terms of this license, you are authorized to share and redistribute the content across various mediums, subject to adherence to the specified conditions: you must provide proper attribution to Stoneridge as the original creator in a manner that does not imply their endorsement of your use, the material is to be utilized solely for non-commercial purposes, and alterations, modifications, or derivative works based on the original material are strictly prohibited.

Responsibility rests with the licensee to ensure that their use of the material does not violate any other rights.

Start the Conversation

It’s our mission to help clients win. We’d love to talk to you about the right business solutions to help you achieve your goals.

Subscribe To Our Blog

Sign up to get periodic updates on the latest posts.

Thank you for subscribing!