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
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.
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).
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.
if all else fails insert a rectangle in a column then paste your data fields on top that should do it
© 2022 - 2025 — McMap. All rights reserved.