SSRS Expression - Line break/new line after coma in value

Line should only break after coma value rather than breaking the value 1234 I am looking for an expression to achieve that. Changing textbox size is not in scope.

12.2k 3 3 gold badges 28 28 silver badges 54 54 bronze badges asked Mar 19, 2018 at 7:57 13 1 1 silver badge 8 8 bronze badges

2 Answers 2

I am fairly confident that what you want is not possible without assuming that the values between the commas will always be the same length.

Your text is breaking in the 'middle' of a value because SSRS does not know that your commas should be treated as breaking characters, like it would a space .

As a result, your options are limited and depend on what the purpose of this textbox is. If you just want to display the data, then you can worry less about how the break is defined but if you need to use this data elsewhere you do need to worry.

If you need to use the data elsewhere via copy and paste and you absolutely can't have the spaces you're mostly out of luck. If you don't have to copy the data anywhere you have two options you can simply add spaces after your commas to get the breaks you want in the report:

Option 1 - Visible Space Character

Use replace to swap all comma characters with a comma and a space which will show up on the report. Whilst this may not be aesthetically desirable, at least it is obvious what is happening in the report, unlike option 2.

=replace(Fields!YourCol.Value, ",", ", ") 

Option 2 - Non-Visible Space Character

Use replace again, but swap the comma with a comma and a Zero-Width Space character. Whilst in the report design this will be apparent, anyone trying to copy the data may get issues as there are characters present that cannot be seen. You can see this by selecting the text he​re. As you hold shift and move left and right using the arrow keys, you will notice that you need an extra press to get between he and re .

The unicode character number you need for this is 8203 , which you can use with the ChrW ssrs function:

=replace(Fields!YourCol.Value, ",", "," & chrw(8203))