try this...
Response.Clear( )
Response.Buffer = True
Response.Conten tType = "applicatio n/vnd.ms-excel"
Response.Charse t = ""
Dim oStringWriter As New System.IO.Strin gWriter
Dim oHtmlTextWriter As New System.Web.UI.H tmlTextWriter(o StringWriter)
oHtmlTextWriter .Write("<html>< head>")
oHtmlTextWriter .Write("<style> ")
oHtmlTextWriter .Write(".dataGr idHeader{font-weight: bold;font-size:
8pt;color: black;font-family: Verdana;backgro und-color: #ddddee;text-align:
left;}")
oHtmlTextWriter .Write(".dataGr idItemStyle{fon t-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(">")
dgReport.Render Control(oHtmlTe xtWriter)
oHtmlTextWriter .Write("</form></body></html>")
Response.Write( oStringWriter.T oString())
Response.End()
--
http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
---_,>/'_------
(_) \(_)
---------------
"Bidarkota" wrote:
When i export DataGrid to Excel all the HTML contents are also exporting to
excel. i am using stylesheets in the ASPX Page and i am getting an alert
message that stylesheets are missing. i need to export only the contents of
the Datagrid to excel. i don't need all other stuff which is present on the
page. is there any way to achieve it.
Thanks in Advance