Sunday, February 26, 2012

format in pdf

Hy,

I would like to convert my report in pdf. Do you have the code to convert it? I found a lot of code for crystal report but not for Reporting service.

thank you

oolon

In fact, I try to use this kind of code

ReportingService rs = new ReportingService();

rs.Credentials = System.Net.CredentialCache.DefaultCredentials;

byte[] ResultStream;

string[] StreamIdentifiers;

string OptionalParam = null, filename = "NorthwindCustomers.pdf";

ParameterValue[] optionalParams = null;

Warning[] optionalWarnings = null;

ResultStream = rs.Render("/Northwind Customers", "PDF", null,

"<DeviceInfo><StreamRoot>/RSWebServiceXS/</StreamRoot></DeviceInfo>", null, null,

null, out OptionalParam, out OptionalParam, out optionalParams,

out optionalWarnings, out StreamIdentifiers);

// Creating a verbatim string.

FileStream stream = File.OpenWrite(@."C:\Articles\SQL Server Reporting

Services\SourceCode\RSWebServiceXS\NorthwindCustomers\" + filename);

stream.Write(ResultStream, 0, ResultStream.Length);

stream.Close();

But my code doesn't recognize The class Reporting Service. Why? i put the librairies :

using System;

using System.IO;

using System.Web;

using System.Web.Services;

using System.Web.Services.Protocols;

What librairy's missing?

Thank you

|||You need to create the proxy class, if you haven't already done this. Take a look at this page for instructions:

http://msdn2.microsoft.com/en-us/library/ms155134.aspx

If you use the Web Reference method, the proxy classes are generated in the default namespace of your project with the reference name you specified in the Web Reference tool.

No comments:

Post a Comment