How to use Page Buffer for ReportViewer

When we view big reports we can face a necessity to decrease memory consumption. We can do that using Page Buffer that allows store just part of pages in memory and unload unnecessary ones.

In this article we will review how to configure Page Buffer in Viewers for SQL Server Reporting Services.

Page Buffer is set with the help of 3 properties of ReportViewer:

  1. UsePageBuffer – this property indicates whether buffer is used or not. If buffer is not used, the whole report is stored in memory and unnecessary pages are not unloaded..
  2. PageBufferLengthBefore property indicates how many pages before the current (displayed) page should be stored in memory. The default value for the property is 1. This means that it stores a single page before the current one. 
  3. PageBufferLengthAfter property indicates how many pages after the current (displayed) page should be stored in memory. The default value for this property is also 1.

To make the buffer work it is enough to indicate UsePageBuffer=true in XAML or CodeBehind. In this case, up to 3 pages will be simultaneously stored in memory. Besides, you can set the number of pages BEFORE and AFTER the current one which should be stored in buffer. To do that you just need to set the corresponding values for the PageBufferLengthBefore and PageBufferLengthAfter properties.

Add Feedback