Showing posts with label formatting. Show all posts
Showing posts with label formatting. Show all posts

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

Monday, March 19, 2012

Line Break formatting

I have a report with a narrow column. The column contains a comma delimited number list.

If the length of the string exceeds the width of the column then the line breaks. No problem with this, except that there are breaks between the numbers.

Example:

123,124,125,126

can be formatted as

123,12
4, 125,1
26

I'd like to force a break at a position within the string if its on the comma. Any thoughts on doing this in the Expressions window?

TIA

anyone please?|||you'll need to have space after the commas.|||

By assuming that all your number list of three digits than we can adjust the column width such that it fixes the numbers. if numbers are not fixed length digits than i wont think we can do .

|||The numbers can be any length (1 to n digits). They are also not always guaranteed to be numeric; they can be alphanumeric as well (but still sequential).|||Use vbcrlf. I'm putting a line break in my address with the below code. I tried \r\n, <br>, all kinds of stuff. vbcrlf is what I needed.

=Fields!SHIPTO.Value & vbcrlf & Fields!SHP_TO_CTY.Value & ", " & Fields!SHP_TO_ST.Value & " " & Fields!SHP_TO_ZIP.Value
|||vbcrlf will work but seeing as we're in the .NET world now I would recommend using Environment.NewLine

Line Break formatting

I have a report with a narrow column. The column contains a comma delimited number list.

If the length of the string exceeds the width of the column then the line breaks. No problem with this, except that there are breaks between the numbers.

Example:

123,124,125,126

can be formatted as

123,12
4, 125,1
26

I'd like to force a break at a position within the string if its on the comma. Any thoughts on doing this in the Expressions window?

TIA

anyone please?|||you'll need to have space after the commas.|||

By assuming that all your number list of three digits than we can adjust the column width such that it fixes the numbers. if numbers are not fixed length digits than i wont think we can do .

|||The numbers can be any length (1 to n digits). They are also not always guaranteed to be numeric; they can be alphanumeric as well (but still sequential).|||Use vbcrlf. I'm putting a line break in my address with the below code. I tried \r\n, <br>, all kinds of stuff. vbcrlf is what I needed.

=Fields!SHIPTO.Value & vbcrlf & Fields!SHP_TO_CTY.Value & ", " & Fields!SHP_TO_ST.Value & " " & Fields!SHP_TO_ZIP.Value
|||vbcrlf will work but seeing as we're in the .NET world now I would recommend using Environment.NewLine