SSRS的一些格式问题
2014-05-23 21:26
525 查看
Getting Started Formatting SSRS Reports
ByFranco Lopes
Formatting SSRS Report
Introduction
The SSRS report once ready needs to beformatted to make it pixel perfect for viewing and printing. The formatting canbe classified into the following types:Conditional Formatting
Unconditional Formatting
ConditionalFormatting
The conditional formatting is doneusing the IIF and switch statements. For conditional formattingcan be used to display the alternate rows with the specific color codes.UnconditionalFormatting
Unconditional formatting can be usedto format the report for the date and number values in a report. For example displaying the date in theIndian format, with the default date is displayed in the US format.ImplementingFormatting in SSRS Report
Let work thorugh a sample report formatting exercise.I created a sample report whose output is below.As you can see the report is just the raw draft of the requirements given tothe developer but still not in the state to present it to the end businessuserand also lacks the basic formatting for the displaying the data as well.
We can begin with setting the Title to the center.The SSRS has a tool bar button to horizontally center align the Titles or anyother report item in the exact center of the page. The tool also has thesimilar functionality for the vertical center alignment
of a report item.
Right click on the textbox of theNumber field you want to format and go to the textbox properties :
Click on the number and select theNumber in the category. Click the check box for the thousands :
To display the values in thecurrency format right click on the sale amount field
Inthe text box properties click on the currency and check the thousand separatorbox. By default it will show the Dollar sign ($) but you can customize it tospecify the currency of your country by clicking on the symbol button.
Next we will do some conditional formatting to displaythe report rows in the alternate color for better visualizations. For thisclick on the details row on the tablix and right click and go to the properties(F4) and enter the following code in the background
color expression:
= IIF(RowNumber (Nothing) Mod 2 = 0,"LightGrey", "Transparent")
This will display the Tablix rows in the alternatecolors. You may change the color scheme as per your requirement.
The sales amount total is being shown in the thousandsand therefore only few digits can been seen as the values have been formattedto thousands.
· Now to format the date to bedisplayed in the Indian format. Right click on the date textbox and go toexpressions and add the following expressions to format the date:
Preview the report to see the output which will be asfollows:
More details on the date formatting can be found onthe msdn documentation. You can find it
here.
Alternatively, the conditional formatting can also be achieved byusing the switch statement as follows:
Click on the Sales Amount andpress F4.
Go to the color and specify thefollowing code in the expression
To make it look a bit more professional I will justadd some fields, displaying the report run date and the report user who hasgenerated the report.
You can do this by adding the Global variables such asthe page numbers and the userId fields which are available as the built-infields when you click on the expressions. Also I have used the built inDateTime function Now to get today’s date and time.
Finally the report will look like the following whichhas been made pixel perfect for the printing as well.
相关文章推荐
- 用JSON做数据传输格式中的一些问题总结
- 用JSON做数据传输格式中的一些问题总结
- CurrentCulture and UICulture解决关于全球的的日期格式都能插入数据库和一些如果¥,$的正确显示问题...
- 一些自己指针遇到的问题 这个没啥用- -格式也没整理
- python一些编码的转换格式问题
- NSPredicate 一些格式问题
- SSRS的一些小问题
- xml文件格式出现的一些小问题的解决
- scanf输入格式的一些问题
- 用JSON做数据传输格式中的一些问题总结
- IOS将字符串转换为日期时间格式的一些问题
- 在jsp中的一些格式小问题
- 对STM32 HAL库的一些思考(一)SPI通信的数据格式问题
- 关于mysql的一些时间格式和字符的问题
- Python点滴(八)—图片序列化转为csv格式中遇到的一些问题
- 解决itext生成嵌套PdfPtable时,格式,字体方面的一些问题
- <<< chm格式文件打不开及一些问题
- 关于VIM使用的时候一些格式问题
- 一些基本的数据格式小问题
- 开发BS系统中应该注意的一些问题