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?
问题:
回答1:
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/
回答2:
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".
回答3:
The solution from SHOWKATH VALLI worked best for me. An absolute genius idea!
This is how I implemented it:
- Create an additional column to the right of the one you need widening
- Merge the cells
Click on the column visibility of your new column.
Hide/show based upon a calculation or in my case a value in my select statement that this is a wide column.
Here is the expression I created: =IIF(Fields!Static1Wide.Value=0,True,False)
回答4:
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
回答5:
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.
回答6:
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.
- 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.
- Next, right click the .rdl file under Solution Explorer > Reports section
- Select "<> View Code"
- Look for 1in xml tag. 1 inch width is by default. You can replace 1in with 2in for all columns!
- 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!
回答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) http://i.stack.imgur.com/FvCQF.jpg
Reference: http://technet.microsoft.com/en-us/library/cc645971(v=sql.100).aspx