SSRS Column Width growing, Text not wrapping
Asked Answered
P

4

8

I am creating a report with SSRS, SQL Server 2008-R2. The report has a few matrices, each with the same number of columns, pulling data from different data sets, to give the appearance of a single table. When I render the report in VS, the columns look fine. Columns with long strings of text wrap the text, and the columns stay in alignment. This is the behavior I want from the report. However, when I run the report from a browser (IE or Firefox), the text does not wrap, and the column width expands to fit the text on a single line. This leaves the report with columns of different size, when they should be the same. Is there a way to force the text to wrap and prevent the column width from expanding? I tried the "Can Grow" property, but it looks like that applies only to height, not width

Placard answered 14/4, 2014 at 15:43 Comment(0)
L
8

Just double click the field in the grid (or textbox). It will open up a pop up window. Under 'General' tab change 'Markup type' from 'None - plain text only' to 'HTML - Interpret HTML tags as Style.

List answered 1/4, 2015 at 19:52 Comment(1)
Note this setting is in the Placeholder Properties, not the Text Box Properties. (in case 'double click' didn't get you where you needed to go).Incapacitate
I
2

It looks like SSRS team has tried to implement word-breaking, but didn't complete it. I assume so as they actually render:

<div style="word-wrap:break-word;white-space:pre-wrap;" 
     class="A28f9f53b98ae45d6a21919d29df775da131">Text </div>

but they miss word-break property in their markup. (or is css broken as it requires both word-wrap:break-word does not work? :) here is a nice investigation on the subject )

Anyway, to break text in columns, add the following css to your page with report viewer:

    div [style*="break-word"] {
        -ms-word-break: break-all;
        word-break: break-all;
        /* Non standard for webkit */
        word-break: break-word;
    }

NB: this will NOT break text in column headers (I prefer setting column headers line-breaks manually as the text is fixed and known in design-time).

Infantry answered 21/8, 2014 at 0:55 Comment(1)
Will this work for Word export ? im having this issue only in exported Formats. WebView looks correct with wordwrap but once i export it to Word there are no wordbreaks...Valvulitis
R
2

Sorry to resurrect an old topic, but... There is a way to emulate turning off Word Wrap. You just set Can Grow to "false" for the row containing the data you don't want to wrap, then set the top and bottom padding of all cells in your row to 0, set your vertical alignment to "Bottom", then reduce the height of the row to where it can only display one line of information (remember to allow for characters that extend below the line). But now my rows are so tight that its difficult to read. So you insert a row above or below (depending on where you want the spacing), set Can Grow to "false" and then set the row's height to the difference between what the row with data in it currently is and what it used to be. Now you have a row that can't display more than one line of information and one (or more) that provides the spacing between records that you need. Yes, it's a hack and it's kind of a pain to have to do, but it works well.

Removable answered 14/3, 2018 at 22:42 Comment(0)
C
1

if all else fails insert a rectangle in a column then paste your data fields on top that should do it

Cinematograph answered 18/8, 2016 at 15:6 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.