January 24, 2008 at 1:38 am
Hi,
I want to load reports through the webservices. (I don't use the reportviewer component for reasons of how the way my ajax was setup and client site caching.) But when I render this as pure HTML, I only get the HTML and not the graphs. This seems logical. I read that I had to process the images 1 by 1 with RenderStream. But when I write them out to the response I end up with only the last image. Here I write the images to disk, but then I should find a way to update the URLs in the report.
Isn't there any more convenient way to do this?
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rs As New ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim results As Byte(), image As Byte()
Dim streamids As String(), streamid As String
' Render the report to HTML4.0
results = rs.Render("/SampleReports/Product Line Sales", "HTML4.0", _
Nothing, " ", Nothing, _
Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, streamids)
' For each image stream returned by the call to render,
' render the stream and save it to the application root
For Each streamid In streamids
image = rs.RenderStream("/SampleReports/Product Line Sales", "HTML4.0", streamid, _
Nothing, Nothing, Nothing, Nothing, Nothing)
Dim stream As System.IO.FileStream = _
System.IO.File.OpenWrite("C:\Inetpub\wwwroot\WebApplication1\" & streamid)
stream.Write(image, 0, CInt(image.Length))
stream.Close()
Next
' Write the rendered report to the Web form
Response.BinaryWrite(results)
End Sub
thanks,
Jan
December 15, 2011 at 6:00 am
You can control the location of the images in the rendered html by setting the StreamRoot element of the DeviceInfo XML parameter.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply