I just realized today that if you render a sql reporting services report in html and that report includes images (like charts) that the image won't render. Makes sense, it's html. Luckily there's a way to deal with it. After you call the web service render method, you will get an array of streamIds. You can loop over this array and call the RenderStream method for each streamId. The RenderStream method takes most of the same parameters as the render method does. This will give you a byte array that you can then write out to a file on your web server. Then you have to modify your html to point to this written image. Here's some example code that just writes out to a file. Obviously you'll have to tweak it to finish it up.
Dim historyID As String = Nothing
Dim deviceInfo As String = Nothing
Dim credentials As STN.Reporting.ReportingServices.DataSourceCredentials() = Nothing
Dim reportHistoryParameters As STN.Reporting.ReportingServices.ParameterValue() = Nothing
Dim showHide As String = Nothing
Dim encoding As String
Dim mimeType As String
Dim warnings As STN.Reporting.ReportingServices.Warning() = Nothing
Dim streamIDs As String() = Nothing
Dim results() As [Byte]
results = rs.Render(_reportPath, _
format, _
historyID, _
deviceInfo, _
parameterValues, _
credentials, _
showHide, _
encoding, _
mimeType, _
reportHistoryParameters, _
warnings, _
streamIDs)
For Each streamId As String In streamIDs
Dim streamResults() As [Byte]
streamResults = rs.RenderStream(_reportPath, format, streamId, historyID, deviceInfo, parameterValues, encoding, mimeType)
Dim fileStream As System.IO.FileStream
fileStream = New System.IO.FileStream("C:\attachmentTemp\test.png", System.IO.FileMode.Create) fileStream.Write(streamResults, 0, streamResults.Length - 1)
fileStream.Close()
Next
posted on Wednesday, February 15, 2006 4:47 PM