SSRS tablix column CanGrow property for width?

2020-08-09 08:14发布

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?

7条回答
我欲成王,谁敢阻挡
2楼-- · 2020-08-09 08:32

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/

查看更多
爷、活的狠高调
3楼-- · 2020-08-09 08:36

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

查看更多
够拽才男人
4楼-- · 2020-08-09 08:39

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!

查看更多
唯我独甜
5楼-- · 2020-08-09 08:40

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)

查看更多
来,给爷笑一个
6楼-- · 2020-08-09 08:40

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

查看更多
手持菜刀,她持情操
7楼-- · 2020-08-09 08:47

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.

查看更多
登录 后发表回答