Wednesday, March 21, 2012

Line Feeds in Report Builder

This may seem like a minor formatting issue, but it's preventing deployment of a solution until I fix this bug. This might be fairly simple, but I'm not a SQL guru.

I have a SQL nvarchar field that contains some data with line feeds (little paragraph markers). When I display that field in a report it gets removed. How can I stop that. I need the line feeds.

For example. Data field:

Line1
Line2
Line3

Current output from report:

Line1 Line 2 Line3

Thanks

Scott

Try writing a simple VB function in the code window that converts the line feed char stored in SQL server to an Environment.NewLine

Just put the character you are using for new line in the quotes, then call Code.AddBreaks(Fields!FieldName) from the designer

Shared Function AddBreaks(ByVal value As String)

Return value.Replace("", Environment.NewLine)

End Function

No comments:

Post a Comment