SSRS column width grows, text doesn't wrap

I am creating a report with SSRS, SQL Server 2008-R2. The report has several matrices, each of which has the same number of columns, extracts data from different data sets to create a single table. When I process the report in VS, the columns look great. Columns with long lines of text wrap the text, and the columns remain in order. This is the behavior I want from the report. However, when I run the report from a browser (IE or Firefox), the text is not wrapped, and the column width expands to fit the text on one line. This leaves a report with columns of different sizes when they should be the same. Is there a way to make the text wrap and prevent the width of the column from expanding? I tried the "Can Grow" property, but it looks like it only refers to the height, not the width

+6
source share
4 answers

Just double-click the field in the grid (or text box). It will open a popup. On the General tab, change the Layout Type from No to Plain Text to HTML. Interpret HTML tags as style.

+4
source

The SSRS team seemed to be trying to implement intelligibility, but did not complete it. I assume they really display:

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

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

In any case, to break the text in the columns, add the following css to your page using the 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 interrupt text in column headings (I prefer to set column heading lines manually, as the text is fixed and known at design time).

+1
source

If all else fails to insert a rectangle in the column, then insert your data fields on top to do this

0
source

Sorry to resurrect an old theme, but ... There is a way to imitate disabling Word Wrap. You just set Can Grow to โ€œfalseโ€ for the row containing the data you donโ€™t want to wrap, and then set the top and bottom fill of all cells in your row to 0, set the vertical alignment to โ€œBottomโ€, then reduce the height of the row where it can display only one line of information (do not forget to specify characters that go beyond the line). But now my lines are so dense that they are hard to read. Thus, you insert a row higher or lower (depending on where you want to span), set the value of "Grow Grow" to "false", and then set the height of the row to the difference between what the row with data in it is in present and what it was, now you have a line that cannot display more than one line of information and one (or more) that provides the distance between the necessary records. Yes, itโ€™s a hack and itโ€™s a pain to be done, but it works well.

0
source

All Articles