In this article we will show you, How to add Rectangle to SSRS Report. This is one of the most useful Report Item while you are designing a report because you can use this rectangle to combine Images, Text Boxes, Charts etc in one place. So, here we will show you the step by step approach to add rectangle to SSRS Report with example.
To explain the same, We are going to use below shown Data Set. Please refer Embedded Data Source and Dataset articles to understand the steps involved in creating Embedded Data Source, and Dataset that we used for this report.
and the Custom SQL query that we used in the above Data set is:
-- Displaying Rectangle on SSRS Report
SELECT [FirstName] + ' ' + [LastName] AS [FullName]
,SUM(FACT.SalesAmount) AS SalesAmount
,SUM(FACT.TotalProductCost) AS ProductCost
FROM [DimEmployee] AS EMP
INNER JOIN [FactResellerSales] AS FACT ON
EMP.EmployeeKey = FACT.EmployeeKey
GROUP BY [FirstName]
Data written by the above query is:
Add Rectangle to SSRS Report
To demonstrate the steps involved to add Rectangle to SSRS Report, We are going to use the previously generated report that we shown below. Please refer Create a New Report, and Add headers and Footer to SSRS Report article for adding Page headers, and footers.
For the demonstration purpose we will add a Rectangle inside the report area. And to do so, please right-click on the report area, and select the Insert, and then Rectangle option from the context menu as we shown below.
Once you select the Rectangle option from the context menu, a new Rectangle will be added to the report area.
You can use your mouse to increase, or decrease the width and height of a Rectangle.
For the demonstration purpose we will add a Text box inside the Rectangle area. And to do so, please right-click on the rectangle, and select the Insert, and then Text Box option from the context menu as we shown below.
Let me add some text to the text box, and then we are adding the Image to the Rectangle. I suggest you to refer Display Image in SSRS Report article to understand the steps involved in adding image to report.
Within the Report preview, you can see the Text that we entered in the text Box, and the Image
Rectangle Properties: Right-click on the rectangle will open the context menu. Please select the Rectangle Properties.. option from the context menu to alter the existing properties of a rectangle.
Once you select the Rectangle Properties.. option, a new window called rectangle Properties will be opened. Under the general tab you can change the name of rectangle, or you can add the page breaks too.
Visibility: Use this tab to decide whether you want to show the rectangle to user, or not.
Under the Fill tab, we can change the background color of a rectangle. Let me change the Background color to Turquoise as we shown below
We have an option to use the External Image as the background of a rectangle. We already explained the steps involved in adding image to Report, or rectangle in Display Image in SSRS Report article so, please refer it.
You can use the Border tab to change the Border style, Color, Type, width, and pattern. For the demonstration purpose, we changed the Presents from None to Outline, Style to Solid, Width to 2pt, and Color to Brown
Click OK button to close the properties window. Please adjust the Report Items (align) so that there will be displayed in one line
As you can see can see from the below screenshot, our rectangle is filed with the Turquoise color, and is surrounded by the Borders of the color that we specified.
Thank You for Visiting Our Blog