I have a report that is returning a one data field to a tablix control field. The data field contains multi-line information in the database. Example below.
In SQL Server,
“Dan Chief – Ceo – Indiana Office”
“Dan Chief – ” & vbcrlf & “Ceo” & ” – Indiana Office”
The vbcrlf’s don’t display in SQL Server but I have confirmed they are present by using instr() in SSRS.
I want the data to display like this. I can remove the hyphens and spaces.
Dan Chief
Ceo
Indiana Office
But in the SSRS report it displays all on one line. I have the autogrow check box selected/on and still nothing.
Any ideas are welcome.
Thanks.
There are two directions to accomplish this. The method you want depends on whether or not you are formatting the text as HTML (Right click on the text in the cell, select
Placeholder Properties. If Markup type is HTML, use the first approach below.)Sounds like you are presenting these as HTML, since the vbcrlf will be displayed if you set to None.
Treating the text as HTML:
You need to replace the vbcrlf with
<br/>tags. This is easiest if you use embedded code in the report. Create a function in the report’s code: Report menu, Report Properties -> Code section.Now set your field to use this code:
=Code.ReplaceLineBreaks(Fields!ColumnA.Value)
If you aren’t treating the text as HTML
vbCrLf should be preserved and displayed in this case, so if that’s really what you have stored in SQL, then you should be fine. If you have some other characters instead in the string, you can alter the ReplaceLineBreaks function I provided above to insert vbCrLf’s.