In this article we will show you, How to add TextBox to SSRS Report. This is one of the common requirement while you are designing report because every report requires Title, or some Address on their headers, or Footer, or any custom text on the Report area. So, here we will show you the step by step approach to add Text Box 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 TextBox on SSRS Report USE [AdventureWorksDW2014] GO SELECT [FirstName] + ' ' + [LastName] AS [FullName] ,[EmailAddress] ,[Gender] ,[Title] ,SUM(FACT.SalesAmount) AS SalesAmount ,SUM(FACT.TotalProductCost) AS ProductCost ,[EmployeePhoto] FROM [DimEmployee] AS EMP INNER JOIN [FactResellerSales] AS FACT ON EMP.EmployeeKey = FACT.EmployeeKey GROUP BY [FirstName] ,[LastName] ,[EmailAddress] ,[Gender] ,[Title] ,[EmployeePhoto]
Data written by the above query is:
Add TextBox to SSRS Report
To demonstrate the steps involved to add TextBox to SSRS Report, We are going to use the previously generated report that we shown below. Please refer Add headers and Footer to SSRS Report article for adding Page headers, and footers.
For the demonstration purpose we will add a Text box inside the report area. And to do so, please right-click on the report area, and select the Insert, and then Text Box option from the context menu as we shown below.
Once you select the text Box option from the context menu, a new Text Box will be added to the report area.
You can use your mouse to increase, or decrease the width, and height of the text box.
For the demonstration purpose, let me add some same text to the text box
Within the Report preview, you can see the Text that we entered in the text Box
Add TextBox to SSRS Table Report
For this demonstration, We are going to use the previously designed report as we shown below. Please SSRS Table Report, Format Table Report in SSRS article to understand the steps involved in creating Table Report & format.
Let me show you the Report Preview. As you can see, report had an empty column with Display TextBox as the header text. here our task is to add the text box to this filed
Every filed (or Column) in Table report itself is a text box. If you select the Column in a table and go to the properties, then it will consider the same as text box.
Let me add the text Box in that particular field. To do so, Please select the Text Box, and Right click on it will open the context menu. Please select the Insert and then Text Box option as we shown below.
Inside the text Box you can write any custom text as per your requirements. But you have to use the Placeholder to place the Column Names. For example, if you want to place the sales amount in this text box then you have to create a placeholder inside the text box. To add the same, right click on the text Box and select Create Placeholder.. option from the context menu.
Once you select Create Placeholder.. option, a new window called Placeholder properties will be opened as we shown below.
- Label: Text you want to show in your report designer.
- Value: Column Name that you want to use
- Tooltip: Use this to provide information about the label.
In this example we will add the title column from our data set
Now you can see the Title label (represent the [Title] column from the Data set)
let me add some custom text, along with the Sales Amount Column.
Let me show you the report preview. From the below screenshot you can see that, the text box is displaying the column values along with custom text.
TextBox Properties: Right-click on the Text box will open the context menu. Please select the Text Box Properties.. option from the context menu to alter the properties of an existing text box.
Once you select the Text Box Properties.. option, a new window called Text Box Properties will be opened. Under the general tab you can assign the name for a text box.
- Alignment Tab is useful to align the text box.
- Number: To format the number in text box to Money, date etc. We already explained this property in Format Numbers in text Box artcile.
- Visibility: Use this tab to decide whether you want to show the Text box to user, or not.
- Interactive Sorting: We already explained this concept in Interactive Sorting in SSRS article so, please refer to it.
- Action: Use this Action tab to enable the action functionality to the image. We already explained about this option in Go to URL article so please refer the same.
Font tab is used to change the text box font. First we will change the FontFamily Property to Cambria, Size to 12pt, Font Style property to Bold.
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, Width to 2pt, and Color to midnight blue
Under the Fill tab, we can change the background color of a text box. Let me change the Background color to Light Steel Blue as we shown below
We have an option to use the External Image as the background of a text Box. We already explained the steps involved in adding image to Report, or text box in Display Image in SSRS Report article so, please refer it.
Click OK button to close the properties window. Please adjust the Columns in a Report so that there will be displayed in one line
As you can see can see from the below screenshot, our Text Box is filed with the Light Steel Blue color, and is surrounded by the Borders of the color that we specified.
Thank You for Visiting Our Blog