SQL Server administration and T-SQL development, Web Programming with ASP.NET, HTML5 and Javascript, Windows Phone 8 app development, SAP Smartforms and ABAP Programming, Windows 7, Visual Studio and MS Office software
Development resources, articles, tutorials, code samples, tools and downloads for ASP.Net, SQL Server, Reporting Services, T-SQL, Windows, AWS, SAP HANA and ABAP


How to Write Text Top to Bottom using Custom Code in SQL Server Reporting Services Reports


Microsoft SQL Server Reporting Services is a flexiable tool for SQL Server Report Developers.
MS SQLServer 2005 SSRS or SQLServer 2008 SSRS Business Intelligence Development Studio (BIDS) gives a handful tools and controls for report developers to build customized reports for their needs.
One of the major tools I apppretiate most is the ability to inject code in your reports. This feature is known as Custom Code in Reporting Services. In the Report Properties dialog screen there exists a tab named Code where you can write custom code for that report.
Now using custom code, I will try to demonstrate how you can write a text or a string value from top to bottom with a sample Reporting Services report.

You now you can arrange the text format in MS SQL Server 2005, using writing mode in the Format tab of the textbox properties.
Or in Microsoft SQL Server 2008 you can alter the writing mode of the text by setting it to vertical.
Or you can use the custome code function SplitTextWithLineBreaks() that I had developed

compare writing mode of string in reporting services





SQL Server 2008 Reporting Services Custom Code Screen

Actually the idea is simple. Split the text into its characters by calling the method ToCharArray() and keep all in a Char() array. Then build a new string by iterating all items in the Character array and adding line breaks using vbCrLf between each character in the string. At last return the resultant text or string back to the caller of the function SplitTextWithLineBreaks()

Public Function SplitTextWithLineBreaks(txt As String) As String

Dim i as integer= 0
Dim returnVal as string = ""
Dim s As Char()

s = txt.ToCharArray

while i < s.Length
   returnVal = returnVal & s(i)
   if i <> s.Length -1 then
      returnVal = returnVal & vbCrLf
   end if
   i = i + 1
end while

return returnVal

End Function
Code

And you can call this custom function by a sample expression like Code.SplitTextWithLineBreaks with the sample code shown below:

= Code.SplitTextWithLineBreaks("SQL Server")
Code

Reporting Services 2008 Writing Mode Vertical



SQL Server

SQL Server 2019 Installation
download SQL Server 2019
download SQL Server 2017
download SQL Server 2016
download SQL Server 2014
download SQL Server 2012
MacOS ve SQL Server 2019


Copyright © 2004 - 2021 Eralper YILMAZ. All rights reserved.