Report Width and Pagination
I am using SSRS 2008. I have a tablix that is generated based on some criteria that user selects. There are few occasion that tablix can be bigger the than the body
width which result on report rendering extra page. Is there a way to control in SSRS.kutabale
April 28th, 2010 6:49pm
Hi kutabale,
If you could tell us how to display the report content, we can give you some workaround. Since your report content is wider than the report body, the surplus part of the content
can only be displayed in another page. This is by design. Thanks for your understanding.
Regards,
Challen Foo
Free Windows Admin Tool Kit Click here and download it now
May 3rd, 2010 10:53pm
Challen,
Is there a feature by which we can dynamically set the width of the report page? I know now this property is available for charts in the latest release. Atleast a feature like fit width to one page should be there, it would be so useful. Right now, we have
to define all the width and height manually and check whether it works in the preview and then again come back and modify till it becomes correct. Don't you think it would be useful?Cheers,
Jason
My Blog
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
May 3rd, 2010 11:24pm
Hi Jason,
I am glad to discuss with you! Controlling the width of the report dynamically is really useful in the scenario you descript. We will not
have to define all the width and height manually and check whether it works in the preview and then again come back and modify till it becomes correct as you stated. Right now, there is a work around to solve the issue. That is adding column
break to the report content rather than controlling the width of the report. Steps are below:
§
Step one:
copy the following code to the custom code area
Dim FlagTable As System.Collections.Hashtable
Dim Flag AS Integer
Function MyFunc(ByVal NewValue As Object) As Integer
If (FlagTable Is Nothing) Then
FlagTable = New System.Collections.Hashtable
End If
If (NewValue Is Nothing) Then
NewValue = "-"
End If
If (Not FlagTable .Contains(NewValue )) Then
Flag =Flag + 1
FlagTable.Add(NewValue, nothing)
End If
MyFunc = Flag
End Function
§
Step two: Add a list to your report
1.
Right-click the list ,and then select Properties.
2.
Click Edit details group… button
3.
Type in the expression
=Ceiling(Code.MyFunc(Fields!Month.Value)/6)
Note:
ü
Fields!Month.Value
is your column group datafield
ü
6 is the number of the columns you want to display in a row
§
Step three:
Sort the dataset by column group field, and then drag the matrix into the list
1.
Switch to the data tab.
2.
Add ‘order by datafield’ to sort the dataset by the column group datafield
here is a example:
select * from vProductProfitability
where Year=2003 and
MonthNumberOfYear in (1,2,3,4,5,6,7,8,9,10,11,12)
order by MonthNumberOfYear
3.
Drag the matrix into the list and preview the report.
Below picture2 is produced by the top method, we can see that original matrix is too long to render in one PDF , however picture 2 can fit the width of the PDF. You can reset the
number of the column to display in one matrix.
Beside this , you can also spread the columns from one matrix into several matrixes. You can first copy one matrix and then paste it into several ones you want. Then set the filter
for each column group to make sure that the total columns’ length in one matrix just fit a page’s width.However I would recommend you adopt the first method,it is more flexible than the second method.
Regards,
Challen Foo
Free Windows Admin Tool Kit Click here and download it now
May 4th, 2010 2:37am
Hmmm, interesting workaround! Let me try this out :), would save a lot of time fiddling around with the page width..
By the way, will it work if we don't know how many number of columns we would like to display, for eg, in the above case it is 6 but if we have a dynamic column, which would depend on a report parameter? I presume, we would need to put the maximum number
of columns there right? Or can we make that also as a variable and use it in the code?Cheers,
Jason
My Blog
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
May 4th, 2010 2:53am
Hi Jason,
It still works if we don't know how many columns we would like to display, you can have a try.
To your second quetion"if we have a dynamic column, which would depend on a report parameter?", It could depend on a report parameter. Just add a parameter to youre report, replace the expression with
=Ceiling(Code.MyFunc(Fields!Month.Value)/Parameters!Number.Value) ,then you could decide how many columns you want to display in one row.
Regards,
Challen Foo
Free Windows Admin Tool Kit Click here and download it now
May 4th, 2010 5:08am
Cool, I will try this out and let you know if I have any issues :)
Thank you Challen
And hopefully the author has also found the asnwer to his post hereCheers,
Jason
P.S. : Please click the 'Mark as Answer' button if a post solves your problem! :)
May 4th, 2010 9:01am
Hi Challen,
I'm trying to use this method to split a matrix with a lot of columns of a Microsoft Report (rdlc) into a Visual Studio 2010 project.
I've followed all your instructions, but I've a problem.
It split the matrix, but only for the first row. Is because i've 3 row groups?
The matrix row groups is on [IMPIANTO] [PROVINO] and [STRUMENTO], the first 3 rows.
The matrix column group is on [COD_ELE].
Any idea?
Thank you
Free Windows Admin Tool Kit Click here and download it now
June 13th, 2012 5:04am