John Straka
John Straka

Reputation: 1889

SSRS tablix column CanGrow property for width?

I'm working on a tablix in SSRS 2008 and want my columns to autosize (width only) to their contents. CanGrow only affects height. Is there a property I'm missing or any way to otherwise rig the columns to do this?

Upvotes: 31

Views: 99810

Answers (7)

SQLBaggers
SQLBaggers

Reputation: 61

The solution from SHOWKATH VALLI worked best for me. An absolute genius idea!

This is how I implemented it:

  1. Create an additional column to the right of the one you need widening
  2. Merge the cells
  3. Click on the column visibility of your new column.

    enter image description here

  4. Hide/show based upon a calculation or in my case a value in my select statement that this is a wide column.

    enter image description here

Here is the expression I created: =IIF(Fields!Static1Wide.Value=0,True,False)

Upvotes: 6

NonProgrammer
NonProgrammer

Reputation: 1387

This may not be the answer you're looking for, but having to adjust width for over 100s of columns at once is just not fun and this little hack does save time.

  1. Create your report through Report Wizard and add All columns you'll need in your report. Doing this created your Tablix! Saves plenty of time since you can select all columns at once.
  2. Next, right click the .rdl file under Solution Explorer > Reports section
  3. Select "<> View Code"
  4. Look for 1in xml tag. 1 inch width is by default. You can replace 1in with 2in for all columns!
  5. Finally, run your report and see if you need to make any adjustment for any columns that did not fit your 2 inches concept.

Give this method a try. If you find anything better or improvements..do let me know!

Upvotes: -2

Shell D
Shell D

Reputation: 23

I got around this with a table that had email addresses in it by using an expression for the 'EMAIL' field:

 =Replace(Fields!EMAIL.Value, "@", System.Environment.NewLine & "@")

You could do something similar if you needed it after say 15 chars (insert the System.Environment.NewLine code after every 15 chars) maybe.

Upvotes: 0

johnecon
johnecon

Reputation: 343

As mentioned here, an easy fix to this issue is to add a row in your tablix and insert a chart to the corresponding column.

Then change its DynamicWidth to an expression like the following =iif(True, "4cm", "2cm") and its DynamicHeight to "0cm".

Chart on tablix to adjust column width

Upvotes: 7

SHOWKATH VALLI
SHOWKATH VALLI

Reputation: 41

we can change width dynamically .follow the below steps

step1:add one more column

step2:merge the added columns with original one

step3:add column visibility expression for extra column based on your requirement

still your not getting then see attached picture

Upvotes: 4

xander
xander

Reputation: 7

To change column width

In Design view, click anywhere in the Tablix data region to select it. Gray column handles appear on the outside border of the Tablix data region.

Hover over the column handle edge that you want to expand. A double-headed arrow appears. Click to grab the edge of the column and move it left or right to adjust the column width.

Check the image below: (im unable to post images here due to low points) https://i.sstatic.net/FvCQF.jpg

Reference: http://technet.microsoft.com/en-us/library/cc645971(v=sql.100).aspx

Upvotes: -10

surfen
surfen

Reputation: 4692

I've been trying to do that myself (client side), without success. There is no property that would autosize the column width.

Check out this workaround: http://blog.sharepointalist.com/2009/05/ssrs-column-width-auto-size.html (I haven't tested it)

The best workaround I've found for client side reporting would be to set column's width in code or use multiple columns and show/hide them based on string length condition.

For example, column named AccNum2:

report.DetailSection1.ReportObjects.Item("AccNum2").width = 200

See this thread for details and other ideas: http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/9e6043f1-c458-4540-be59-d37b02feab8a/

Upvotes: 8

Related Questions