I created a Reporting Services report that uses a custom data processing extension that allows for a .NET ADO.dataset to be passed to the report as its data source. I am using SOAP and the Render method to render this report in a PDF format from a .NET Windows
form. It works fine, except the report doesn't have any of its formatting. In other words, all you see is the raw numbers; the formats that I have in the RS report are not being used. However, if I go to the Report Manager and run the report it works correctly
and is properly formatted. Does anyone know what would cause this. The code I'm using to render the report from a Windows form is posted below. Thanks.
Dim rs As New devsrvReportserver.ReportingService 'Reporting Service web service
Dim paramValue(2) As devsrvReportserver.ParameterValue
Dim paramValue2 As New devsrvReportserver.ParameterValue
Dim paramValue3 As New devsrvReportserver.ParameterValue
paramValue(0) = New devsrvReportserver.ParameterValue
paramValue(0).Name = "DataSource"
paramValue(1) = New devsrvReportserver.ParameterValue
paramValue(1).Name = "beginDate"
paramValue(2) = New devsrvReportserver.ParameterValue
paramValue(2).Name = "endDate"
paramValue(0).Value = ds.GetXml 'this is the dataset
paramValue(1).Value = Me.LblBeg.Text 'beginning date
paramValue(2).Value = Me.LblEnd.Text 'ending date
Dim warnings() As TFM.devsrvReportserver.Warning
Dim streams() As String
Dim mimetype As String = "application/pdf"
Dim encoding As String
Dim type As String = "PDF"
Dim ext As String = "pdf"
'rs.GetReportDefinition("/xmlReport2/abcSalesReport")
Dim result As Byte() = rs.Render("/xmlReport2/abcSalesReport", type, Nothing, "", paramValue, Nothing, Nothing, encoding, mimetype, Nothing, warnings, streams)
Try
Dim stream As FileStream = File.Create("report." & ext, result.Length)
stream.Write(result, 0, result.Length)
stream.Close()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Process.Start("report." & ext)
mike@tfm
Member
74 Points
35 Posts
Problem with formatting when calling a RS report from a Windows Form
Aug 26, 2005 08:29 PM|LINK
I created a Reporting Services report that uses a custom data processing extension that allows for a .NET ADO.dataset to be passed to the report as its data source. I am using SOAP and the Render method to render this report in a PDF format from a .NET Windows form. It works fine, except the report doesn't have any of its formatting. In other words, all you see is the raw numbers; the formats that I have in the RS report are not being used. However, if I go to the Report Manager and run the report it works correctly and is properly formatted. Does anyone know what would cause this. The code I'm using to render the report from a Windows form is posted below. Thanks.
Dim rs As New devsrvReportserver.ReportingService 'Reporting Service web service
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
rs.Url = "http://devsrv/ReportServer/reportservice.asmx"
Dim paramValue(2) As devsrvReportserver.ParameterValue
Dim paramValue2 As New devsrvReportserver.ParameterValue
Dim paramValue3 As New devsrvReportserver.ParameterValue
paramValue(0) = New devsrvReportserver.ParameterValue
paramValue(0).Name = "DataSource"
paramValue(1) = New devsrvReportserver.ParameterValue
paramValue(1).Name = "beginDate"
paramValue(2) = New devsrvReportserver.ParameterValue
paramValue(2).Name = "endDate"
paramValue(0).Value = ds.GetXml 'this is the dataset
paramValue(1).Value = Me.LblBeg.Text 'beginning date
paramValue(2).Value = Me.LblEnd.Text 'ending date
Dim warnings() As TFM.devsrvReportserver.Warning
Dim streams() As String
Dim mimetype As String = "application/pdf"
Dim encoding As String
Dim type As String = "PDF"
Dim ext As String = "pdf"
'rs.GetReportDefinition("/xmlReport2/abcSalesReport")
Dim result As Byte() = rs.Render("/xmlReport2/abcSalesReport", type, Nothing, "", paramValue, Nothing, Nothing, encoding, mimetype, Nothing, warnings, streams)
Try
Dim stream As FileStream = File.Create("report." & ext, result.Length)
stream.Write(result, 0, result.Length)
stream.Close()
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
Process.Start("report." & ext)