Wednesday, May 27, 2009

SSRS Column Width Long Text Problem

Recently I got a weird problem building some reports with SSRS 2008. The column width started to automatically resize based on content, while all columns width are fixed in SSRS by design. The cause of this was long words and long URLs in these fields, which were not able to wrap. Looks like HTML table was adjusting the column size accordingly. (By the way, it was still showing Ok in preview, but was changing the size of columns in published version.) Spent quite a time trying to figure out what to do with that, cause I need those column widths to be static. Here is the solution:

While this problem is caused by native HTML functionality, we can use HTML to fix it.

  1. Change Expression to be something like =”<DIV style=’width:1.2in’>” & Fields!YourField.Value & “</DIV>” where width is the desired static width of this column.
  2. Change placeholder properties – General tab – Markup type – HTML-Interpret HTML tags as styles. (Placeholder properties can be accessed by right clicking on Expression (Field) inside of the cell, not on cell itself).

PS. I am also sure that you can use the same approach to create columns with adjustable or auto width, it just needs some tweaking.

0 comments:

Post a Comment