Showing posts with label displayed. Show all posts
Showing posts with label displayed. Show all posts

Friday, March 30, 2012

Saving Report Viewer rending as an HTML file

I'm trying to get an HTML rendering to an html file instead of being displayed in Internet Explorer. My idea is that maybe I could launch an Internet Explorer with an .aspx page that contains a report viewer. I want to be able to capture the output of the Report Viewer control and save off that HTML to a file and immediately close the IE window.
I have read a post or two on other messageboards from people who said that they have done it, and I also heard from a Microsoft source that this is a perfectly acceptable way of capturing an HTML output since MS removed that export capability before they released the control.
What I'm asking to be done could probably be done on any web control that renders HTML, I just don't know how to do it in the general sense (steal the rendering stream from a web control and save the stream off to a file.)
Hopefully what I said makes sense.
If anyone has any suggestions on how to handle that, I would greatly appreciate it.
Thanks,
Ken
Ken, this gets the report output in a stream, I assume you can take it from there. I found this as an example of someone converting to excel(note the commented out line). So I have not really tested this, I just wanted to help.

Response.Clear()

Response.Buffer =True

' Response.ContentType = "application/vnd.ms-excel"

Response.ContentType = "text/html"

Response.Charset = ""

Dim oStringWriterAsNew System.IO.StringWriter

Dim oHtmlTextWriterAsNew System.Web.UI.HtmlTextWriter(oStringWriter)

oHtmlTextWriter.Write("<html><head>")

oHtmlTextWriter.Write("<style>")

oHtmlTextWriter.Write(".dataGridHeader{font-weight: bold;font-size:8pt;color: black;font-family: Verdana;background-color: #ddddee;text-align:left;}")

oHtmlTextWriter.Write(".dataGridItemStyle{font-size: 8pt;color: black;font-family: Verdana;text-align: left;}")

oHtmlTextWriter.Write("</style>")

oHtmlTextWriter.Write("</head><body>")

oHtmlTextWriter.WriteBeginTag("form runat=server ")

oHtmlTextWriter.WriteAttribute("target", "_blank")

oHtmlTextWriter.Write(">")

ReportViewer1.RenderControl(oHtmlTextWriter)

oHtmlTextWriter.Write("</form></body></html>")

Response.Write(oStringWriter.ToString())

Response.End()

sql

Tuesday, March 20, 2012

Save Query Template

Does reporting service allow to save user input query ? i.e. If user re-run the report, their default selection criteria are displayed automatically.If you mean saving the values of parameters as a per-user default this is
not supported in v1.0, but it is on our wishlist.
--
Rajeev Karunakaran [MSFT]
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"May Liu" <MayLiu@.discussions.microsoft.com> wrote in message
news:FB6666ED-2AD1-4A0D-A707-94041C287732@.microsoft.com...
> Does reporting service allow to save user input query ? i.e. If user
> re-run the report, their default selection criteria are displayed
> automatically.