Tuesday, October 30, 2012

SSRS- How to set Text Box Orientation in the report


1. Background

This article describes how to set the orientation of text box in a report using SSRS 2008 R2/2012. A text box can be oriented in below directions:
  • Horizontally,
  • Vertically (text reading from top to bottom),
  • Rotated by 270 degrees (text reading from bottom to top).
Proper orientation of text box saves lot of space in the report layout e.g a report having 10 columns with text description in horizontal direction will take more space in the report as compared to same report having those columns in vertical direction or 270 degree direction. We set the orientation on the text box not the text. We need to adjust the width and height of the text box to accommodate the rotated text. Here we are going to use WritingMode property of the text box to set the text box orientation.

This approach is useful in the following conditions:
  •   When report is having lot of columns and due to no. of columns, we are getting horizontal scroll while previewing the report.
  •  When multiple tablixes are using in the same report so to manage the space in report layout, we can change text orientation.
  •    Many times, we need to show data for few columns in vertical/270 degree in the report.

2. Prerequisite

·         We should use SQL Server 2008 R2 or 2012 Server

3. Steps to set the text box orientation in the report:

Below is the sample reseller report showing several columns with horizontal orientation:
 
                I.        For setting the orientation of text box, go to the click on the column header’s text box e.g ResellerName and press F4 key to get the property window for ResellerName text box:
 

              II.        Go to WritingMode Property and select Rotate 270:
 
             III.        Now see the column header ResellerName:
 
Here we can see the column header showing text from bottom to top:

            IV.        Now we will see how text looks in vertical orientation. For setting vertical orientation, select Number of Employees column header text box and press F4 to see text box property. Set the WritingMode property of this text box to Vertical:
             V.        Now see the text box in report layout:


Note: It is difficult to read the text in vertical direction so using 270 degree orientation is preferable.

            VI.        Set the orientation of all the column header’s text boxes to 270 degree and preview the report.
 
Here we can see the all the column headers showing text in 270 degree direction (Bottom to Top).
           VII.        If we want to show 270 degree text in centre align then go to the Text Box and click in front of Text and press enter key 2-3 times to align the text :
Here I have pressed “Enter key” 4 times for this text.
         VIII.        Now preview the report:
Here we can see that “Reseller Name” showing centre aligned.

4.   Conclusion

By using the above steps, we can set the orientation of the text box using SQL Server 2008 R2/ 2012.
----------------------------------------------------End of Document---------------------------------------------------

No comments:

Post a Comment