[转]ConsumeContainerWhitespace property to remove blank space in SSRS 2008 report

文章介绍了SSRS 2008报告中出现不必要空白页的问题及解决办法。在SSRS 2005中,空白会自动忽略,而2008默认不忽略。可通过将Report属性ConsumeContainerWhitespace设为true去除空白页,还给出防止不必要分页的逻辑及解决不同场景空白页问题的步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

转自:http://beyondrelational.com/modules/2/blogs/115/posts/11153/consumecontainerwhitespace-property-to-remove-blank-space-in-ssrs-2008-report.aspx

While at starting with SSRS, everybody face the problem of unnecessary blank pages at end. Me and my friend Chirag (Blog) had faced this problem many times and got defects from QA in past for balnk pages.

In SSRS 2005, white spaces are automatically ignored. But in 2008 this behavior gets changed and by default whitespaces are not ignored.  But, There is Report property ConsumeContainerWhitespace which is set to False by default. We can remove blank space at end by setting ConsumeContainerWhitespace to true.

The logic to prevent the unnecessary pagebreak is 
- ReportBody width should be less then Pagesize(width) – Left Margin – Right Margin
- ReportBody height should be less then Pagesize(Height) – Top Margin – Bottom Margin – Header height – Footer height

Sometimes, report is as per these conditions and still we get blank pages.

Problem -1 If we have some space at the bottom or right side after Tablix, sometimes we get blank page at the end based on rows we get from dataset. In this case, We can get rid of that blank page by removing that un-necessary space at end.

Problem-2 In case of matrix report, we can’t remove that space (otherwise page header and footer items like page numbers are not aligned properly at bottom left) and we used to get bank page. We can see this in below example (Same report is attached herewith), 

Setp-1 Dataset Query

1. USE AdventureWorksDW
2. SELECT CountryName = dg.EnglishCountryRegionName
3. , SalesAmount = SUM(fs.SalesAmount)
4. FROM dbo.FactInternetSales FS
5. INNER JOIN dbo.DimGeography dg on FS.SalesTerritoryKey = dg.SalesTerritoryKey
6. GROUP BY dg.EnglishCountryRegionName
7. ORDER BY dg.EnglishCountryRegionName

Step-2  Create matrix report with CounrtyName as columnGrouping value and set the column width to 25mm

Setp-3 Set following properties. 
Report Body Height:- 7in
Report Body Width:- 6in
Header and Footer  Height:  0.7in.
All four margins are of 1 in.
Report Height:- 11in
Report  Width:- 8.5in

Setp-4 Add a page-number in footer at bottom right.

Setp-5 Run a report and export to PDF.
We will get the blank page at end.

Step-6 Set ConsumeContainerWhitespace to true in report property as shown below.

ConsumeContainerWhitespace Property

Step-7 Run Report and export to PDF

Now, There will not be blank pages at end.

References
http://msdn.microsoft.com/en-us/library/ms143200.aspx

转载于:https://www.cnblogs.com/msdynax/p/3949634.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值