Client Printing Support in SQL Server Reporting Using SOAP
page 1 of 3
Published: 26 Jun 2007
Abstract
The article is about printing reports directly from an application using the rendering of the reports with the help of web services exposed by Microsoft to access Report Server.
by vikas chaudhary
Feedback
Average Rating: 
Views (Total / Last 10 Days): 23673/ 57

Introduction

As the reports rendered by the "Render()" web method do not support the toolbar provided in the "ReportViewer" control, it makes a difficult choice for a programmer to print reports from the application directly.

One of the method to use, the printing functionality as in toolbar of the ReportViewer control, can be implemented by certain customization in the application. This can be said as Direct Client printing Technique obtained by the combination of certain HTML and JavaScript Code.

The procedure starts by adding a simple object in your HTML at the page as shown

Firstly, add a tag named object to the HTML file under the <body> tag.

Listing 1

<OBJECT id="RSClientPrint" codeBase=
"http://urservername/reportserver?rs:Command=Get&
rc:GetImage=9.00.3042.05rsclientprint.cab#Version=2005,090,3042,000"
 classid="CLSID:FA91DF8D-53AB-455D-AB20-F2F023E498D3" VIEWASTEXT> </OBJECT>

Then write a function; in our example it is named PrintAll(), which sets the properties of the page to be printed using this object "RSClientPrint."

You can call this function on any event at <body onload =PrintAll()>.

Listing 2

function PrintAll() 
{ 
RSClientPrint.MarginLeft = 12.7; 
RSClientPrint.MarginTop = 12.7; 
RSClientPrint.MarginRight = 12.7;
 RSClientPrint.MarginBottom = 12.7; 
RSClientPrint.Culture = 1033;
 RSClientPrint.UICulture = 9; 
RSClientPrint.Print('http://<ur server name>/ReportServer',
  '/Report Project/report1&Param1=in&Param2=497&Param3=1', 'report1') 
}

This code works as in ReportViewer toolbar print button uses the ActiveX control i.e. RSClientPrint Class, to open a print dialog box which enables the client computer to customize the print settings and enables easy client printing.

Besides this, a lot more is there if you dig in details of the functionality behind this, but that requires thorough reporting knowledge and some hands on experience in windows API dealing with System32.dll. You should learn about extracting the basic functionality of the printing that is avoided, so as not to create confusion as well as using the code straight forwardly in the application.


View Entire Article

User Comments

No comments posted yet.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2017 ASPAlliance.com  |  Page Processed at 2017-10-19 11:33:48 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search