Showing posts with label launch. Show all posts
Showing posts with label launch. 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 Designer Layout

I launch the Query Designer from the Microsoft SQL Server 2005 Management
Studio to design some queries. Can anyone tell me if there is a way to save
the graphical layout of the tables, joins, etc.? Am I missing something
really basic?
Rob (Rob@.discussions.microsoft.com) writes:
> I launch the Query Designer from the Microsoft SQL Server 2005
> Management Studio to design some queries. Can anyone tell me if there
> is a way to save the graphical layout of the tables, joins, etc.? Am I
> missing something really basic?
I don't think there any such option. If you feel this is important, you
can suggest it on http://connect.microsoft.com/sql
Personally, my enthusiasm for the Query Designer is low. There are
very many queries that it is not able to manage, and if you want to
evolve as an SQL programmer, using QD too much may hold you back.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
|||Thanks for the feedback Erland. I often use Query Designer just to get
started on the basics of a query. Is there another tool you recommend or is
your preference just to code the whole thing from scratch?
"Rob" wrote:

> I launch the Query Designer from the Microsoft SQL Server 2005 Management
> Studio to design some queries. Can anyone tell me if there is a way to save
> the graphical layout of the tables, joins, etc.? Am I missing something
> really basic?