Group...
I have a requirement to add a custom button to an ASPX 'View PDF'. When the
user clicks this button a specific SSRS report will be returned (Open/Save)
as a pdf. I need to be able to do this without using the MS Sample Report
Viewer control (which has the 'Select a format, Export' option just like in
Report Manager).
From what I have read there may be a call that can be made to the RS Web
Service, is this true and if so, is this the only way to accomplish a PDF
export.
Thanks in advance everyone.I have same case as yours, and I am using web service call to accomplish
this. I dont know if there is another way but using RS web service is quite
easy. If you need further information or sample code drop a message.
Regards
"Terry Mulvany" <terry.mulvany@.rouseservices.com> wrote in message
news:eHXMZx92EHA.1452@.TK2MSFTNGP11.phx.gbl...
> Group...
> I have a requirement to add a custom button to an ASPX 'View PDF'. When
the
> user clicks this button a specific SSRS report will be returned
(Open/Save)
> as a pdf. I need to be able to do this without using the MS Sample Report
> Viewer control (which has the 'Select a format, Export' option just like
in
> Report Manager).
> From what I have read there may be a call that can be made to the RS Web
> Service, is this true and if so, is this the only way to accomplish a PDF
> export.
> Thanks in advance everyone.
>|||Do you have a sample link handy?
Thanks so much.
"saglamtimur" <bsaglamtimur@.mayanet.com.tr> wrote in message
news:ul5ho$92EHA.2540@.TK2MSFTNGP09.phx.gbl...
>I have same case as yours, and I am using web service call to accomplish
> this. I dont know if there is another way but using RS web service is
> quite
> easy. If you need further information or sample code drop a message.
> Regards
>
> "Terry Mulvany" <terry.mulvany@.rouseservices.com> wrote in message
> news:eHXMZx92EHA.1452@.TK2MSFTNGP11.phx.gbl...
>> Group...
>> I have a requirement to add a custom button to an ASPX 'View PDF'. When
> the
>> user clicks this button a specific SSRS report will be returned
> (Open/Save)
>> as a pdf. I need to be able to do this without using the MS Sample Report
>> Viewer control (which has the 'Select a format, Export' option just like
> in
>> Report Manager).
>> From what I have read there may be a call that can be made to the RS Web
>> Service, is this true and if so, is this the only way to accomplish a PDF
>> export.
>> Thanks in advance everyone.
>>
>|||My custemer can chose which format to download. I have a sub that accepts
mime type, so I can pass render format to sub, and use one sub for all
formats.
First you must add web referance to ReportService.
Here is the code;
Private Sub renderdoc(ByVal mime As String)
Dim mime_type As String
Dim filename As String
Select Case mime
Case "pdf"
mime_type = "application/pdf"
filename = "fiyatlistesi.pdf"
Case "Excel"
mime_type = "application/x-msexcel"
filename = "fiyatlistesi.xls"
Case "xml"
mime_type = "application/xml"
filename = "fiyatlistesi.xml"
Case Else
mime_type = "application/pdf"
filename = "fiyatlistesi.pdf"
End Select
Dim report As Byte() = Nothing
Dim rs As localhost.ReportingService = New
localhost.ReportingService
'login details comes here
rs.Credentials = New
System.Net.NetworkCredential("raport_user_name_here", "password_here")
rs.PreAuthenticate = True
'report path here, I have a report named fiyat.rdl
Dim reportPath As String = "/rapor/fiyat"
Dim format As String = mime
Dim devInfo As String = _
"<DeviceInfo>" + _
"<Toolbar>False</Toolbar>" + _
"<Parameters>False</Parameters>" + _
"<DocMap>True</DocMap>" + _
"<Zoom>100</Zoom>" + _
"</DeviceInfo>"
Dim historyID As String = Nothing
'I have 3 report parameters, I define them here
Dim parameters(2) As localhost.ParameterValue
Dim paramValue As localhost.ParameterValue = New
localhost.ParameterValue
'First param name is cari_isim (ok its in Turkish)
paramValue.Name = "cari_isim"
paramValue.Value = textbox1.text
parameters(0) = paramValue
'second here
paramValue = New localhost.ParameterValue
paramValue.Name = "fiyatgrup"
paramValue.Value = textbox2.text
parameters(1) = paramValue
'third here
paramValue = New localhost.ParameterValue
paramValue.Name = "urunler"
paramValue.Value = dropdownlist1.selecteditem.value
parameters(2) = paramValue
Dim credentials() As localhost.DataSourceCredentials = Nothing
Dim showHideToggle As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings() As localhost.Warning = Nothing
Dim reportHistoryParameters() As localhost.ParameterValue = Nothing
Dim streamIDs() As String = Nothing
Dim sh As localhost.SessionHeader = New localhost.SessionHeader
rs.SessionHeaderValue = sh
Try
report = rs.Render(reportPath, format, historyID, _
devInfo, parameters, credentials, _
showHideToggle, encoding, mimeType, _
reportHistoryParameters, warnings, _
streamIDs)
sh.SessionId = rs.SessionHeaderValue.SessionId
Response.Clear()
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = mime_type
HttpContext.Current.Response.AddHeader("Content-disposition",
"attachment; filename=" + filename + "")
HttpContext.Current.Response.BinaryWrite(report)
HttpContext.Current.Response.Flush()
HttpContext.Current.Response.End()
Catch ex As Exception
If ex.Message <> "Thread was being aborted." Then
HttpContext.Current.Response.ClearHeaders()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "text/html"
HttpContext.Current.Response.Write( _
"&
Error" & _
ex.Message & "
")
HttpContext.Current.Response.End()
End If
End Try
End Sub
Hope works for you.
Regards
"Terry Mulvany" <terry.mulvany@.rouseservices.com> wrote in message
news:#yYGGv#2EHA.1264@.TK2MSFTNGP12.phx.gbl...
> Do you have a sample link handy?
> Thanks so much.
> "saglamtimur" <bsaglamtimur@.mayanet.com.tr> wrote in message
> news:ul5ho$92EHA.2540@.TK2MSFTNGP09.phx.gbl...
> >I have same case as yours, and I am using web service call to accomplish
> > this. I dont know if there is another way but using RS web service is
> > quite
> > easy. If you need further information or sample code drop a message.
> >
> > Regards
> >
> >
> >
> > "Terry Mulvany" <terry.mulvany@.rouseservices.com> wrote in message
> > news:eHXMZx92EHA.1452@.TK2MSFTNGP11.phx.gbl...
> >> Group...
> >> I have a requirement to add a custom button to an ASPX 'View PDF'. When
> > the
> >> user clicks this button a specific SSRS report will be returned
> > (Open/Save)
> >> as a pdf. I need to be able to do this without using the MS Sample
Report
> >> Viewer control (which has the 'Select a format, Export' option just
like
> > in
> >> Report Manager).
> >>
> >> From what I have read there may be a call that can be made to the RS
Web
> >> Service, is this true and if so, is this the only way to accomplish a
PDF
> >> export.
> >>
> >> Thanks in advance everyone.
> >>
> >>
> >
> >
>|||In the URL for the report you can specify the Render property for whatever
output you wish. The following (part) URLs demonstrate this. I have a number
of buttons on my asps, that allow the user to output directly to XL, PDF or
the standard RS report page, by using the following::
NOTE: I use javascript to create the link and then open a new results window
at this point::
function GET_RS(aFormat)
{
var sReportName="myReport1";
if(aFormat=="EXCEL"){sReportName="ReportRS1XL";GET_HELP('XL')}
if(aFormat=="PDF"){sReportName="ReportRS1";GET_HELP('PD')}
HLINK = HLINK + "http://myServer/ReportServer"
HLINK = HLINK + "?%2fBaanReports%2f"+sReportName HLINK = HLINK +
"&rs%3aClearSession=true"
HLINK = HLINK + "&rs%3aCommand=Render"
HLINK = HLINK + "&rs%3aFormat=" + aFormat
.....
....
}
This blows through the standard RS page, where the user then has to select
the output format and click the Export link.
Hope this helps
Tony
"Terry Mulvany" wrote:
> Group...
> I have a requirement to add a custom button to an ASPX 'View PDF'. When the
> user clicks this button a specific SSRS report will be returned (Open/Save)
> as a pdf. I need to be able to do this without using the MS Sample Report
> Viewer control (which has the 'Select a format, Export' option just like in
> Report Manager).
> From what I have read there may be a call that can be made to the RS Web
> Service, is this true and if so, is this the only way to accomplish a PDF
> export.
> Thanks in advance everyone.
>
>