Everclear (Setting Published Report Print Properties)

In a previous post, I described some of the rules around report pagination. I mentioned that you can change the page settings of a published report using the SetProperties web service method. This is especially useful in that we neglect to propagate the print settings to linked reports during linked report creation or republishing of the target report. So here is a quick VB snippet that shows you how to set these properties:

Dim rs As New ReportingService.ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.Url = "http://localhost/reportserver/reportservice.asmx"

Dim p(5) As ReportingService.Property
p(0) = New ReportingService.Property
p(0).Name = "PageHeight"
p(0).Value = 8.5 * 25.4
p(1) = New ReportingService.Property
p(1).Name = "PageWidth"
p(1).Value = 11 * 25.4
p(2) = New ReportingService.Property
p(2).Name = "TopMargin"
p(2).Value = 0.5 * 25.4
p(3) = New ReportingService.Property
p(3).Name = "BottomMargin"
p(3).Value = 0.5 * 25.4
p(4) = New ReportingService.Property
p(4).Name = "LeftMargin"
p(4).Value = 0.5 * 25.4
p(5) = New ReportingService.Property
p(5).Name = "RightMargin"
p(5).Value = 0.5 * 25.4

rs.SetProperties("/LinkedReport", p)

Note that all of the measurements are in millimeters. The code is essentially the same for SQL 2005 RS.

Comments (1)
  1. Edmund says:


    I am using SSRS 2005 and implementing an ASP.NET page that hosts a ReportViewer. The report is set for a Legal size report. I peeked into the Reporting database and confirmed the properties to be indeed set for an 8.5×14 Legal document size (in milimeters, of course).

    But when printing via the ReportViewer, the printing dialog box is set to a Letter (8.5×11) and needs to be changed manually for the report to be correctly printed.

    Why doesn’t the printer pickup the settings automatically. More over, the manual change is not persisted so every print, I need to change to Legal size.

    I have tried several drivers for several different printers (laser, dot matrix).

    What am I doing wrong?

    Thanks, Edmund

Comments are closed.

Skip to main content