Groups | Blog | Home
all groups > sql server reporting services > june 2006 >

sql server reporting services : Winform: Launch in PDF Post-Render?


crferguson NO[at]SPAM gmail.com
6/28/2006 2:43:33 PM
I'm building a winform application and I've managed to use the
Reporting Services webservice to render a report after passing it a
parameter, but I can't figure out how launch it in Acrobat after
rendering. I've done it in a web app using Response like this:

Response.ContentType = "application/pdf"
Response.AddHeader("Content-Disposition", "attachment;
filename=thefile.pdf")
Response.BinaryWrite(rByte)

That present the web user an "Open/Save" open which will open the
report in Acrobat after the rendering is complete. But, of course,
Response isn't an option in a winform app. Is there a winform
equivalent of doing this? Here's my code so far in my winform's Load
event (which btw does not produce an error meaning it's completing the
rendering portion):

Private Sub ReportViewer_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'setup Report Server connection code would go here and then...

Dim rService As New wsReportService.ReportingService

Dim rPrm(0) As wsReportService.ParameterValue
rPrm(0) = New wsReportService.ParameterValue
With rPrm(0)
.Name = "ParameterName"
.Value = "123456789"
End With

rService.Render("/ReportFolderName/ReportName", "pdf", Nothing,
"", rPrm, Nothing, Nothing, "", "", Nothing, Nothing, Nothing)

'... and then at this point I'm lost...
End Sub

Any help would be HUGELY appreciated! I've tried the ActiveX web
browser idea and that just doesn't meet my needs. I've read that using
the web service method is the only alternative for those that don't
have SQL2005, VS.NET 2005, etc...

Thank you so much...

Cory
crferguson NO[at]SPAM gmail.com
6/28/2006 2:54:09 PM
My mistake, I forgot that I dim a byte object and set it to the
rendering like so:

Dim rByte as Byte
rByte = rService.Render(Global.ReportPath & RI.ReportName,
RI.Extension, Nothing, "", rPrm, Nothing, Nothing, "", "", Nothing,
Nothing, Nothing)
crferguson NO[at]SPAM gmail.com
6/28/2006 2:55:16 PM
My mistake. I forgot I dimension a byte object and set it to the
rendering like so:


Dim rByte as Byte
rByte = rService.Render("/ReportFolderName/ReportName", "pdf", Nothing,

"", rPrm, Nothing, Nothing, "", "", Nothing, Nothing, Nothing)
crferguson NO[at]SPAM gmail.com
6/29/2006 6:50:20 AM
OK, I've been digging around a lot more and I'm thinking that my issue
is above your heads. It appears that the report is running to a PDF
and that PDF is being returned as a byte. All I need to do is get that
byte to open in Acrobat, but I don't know how to do that. Or maybe
write the byte/pdf to a file and deliver it to the user. Does anyone
have any clue what I'm talking about or can point me in the right
direction?

Thanks!
AddThis Social Bookmark Button