Problem: MS SQL Server
Reporting services has no option to justify text. Idea: Using a T-SQL Function to Format the text as HTML
and ad additional white spaces between the words. Solution:
1. MS Access-Script to measure
the widths of each letter. (Will only be needed once!)
For all of you, who do not have MS Access, here is the result for Arial.
1a. Start MS Access
1b. Go to section "Reports" (German: "Berichte")
1c. Click on "Design" (German: "Entwurf")
1d. Customize the Toolbar, Select "Report Design" (German
1e. Notice that the German word for "Detail Section" is
"Detailbereich". If you work with MS Access in any other language, you
have to change the word in the script.
1f. Open the Code-Window.
1g. Select "Detail Section".
1h. Paste the Script in the
Code-Window. Check that the "Private Sub Detailbereich_Format" is
1i. Close the Code-Window. Select Preview (German "Seitenansicht")
(Marked green in the second screen shot)
1j. Go to the Tables Section (German "Tabellen"). There you will find a
2. Prepare the MS SQL Server Database with the following script. (Create scema
"report", the functions "true" and "false" and the table
3. Transfer the result from the MS Access-Table "Tabelle2" to the table
CharacterWidth MS SQL Server Table.
4. Create Call the function to
In the preview- Window
the result looks ugly. Only the PDF-Export looks OK.
Make the Fields in SSRS two mm wider than the wanted size.
The script calculates everything in mm (25.4mm = 1 inch).
The Solution works fine with "ARIAL". You can change the MS Access-Script to any other Font
MS Access is only needed once for generating the values for
Sorry that the MS Screen shots are from German MS Access XP. Feel
free to send me screenshots from a newer English version.
Critical comments welcome. Please send me an email.