0
Protected Sub Button1_Click(ByVal sender As Object, _     ByVal e As EventArgs)
        Response.AddHeader("content-disposition", "attachment;filename=FileName.xls")
        Response.Charset = String.Empty
        Response.ContentType = "application/vnd.xls"
        Dim sw As System.IO.StringWriter = _          New System.IO.StringWriter()
        Dim hw As System.Web.UI.HtmlTextWriter = _            New HtmlTextWriter(sw)
        GridView1.RenderControl(hw)
        Response.Write(sw.ToString())
        Response.End()
    End Sub

how do i set the format for that after click the button from gridview to excel file??

what's the code for this format??

in page tab:
orientation = landscape
scaling = 30%
paper size = A3
print quality = 300dpi

in margings tab:
width = 0.25
top = 0.25
height = 0.25
bottom = 0.25
left = 0.25
right = 0.25

center on page:
vertical = check

3
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by steave123
0

You can use third partly tool kit. to export in csv,xls or pdf format.

Edited by Ezzaral: Removed "fake sig" link.

0

It CVS format is available on internet where from you can convert it.It is very easy to do.I am also used this work many time.I am looking for if you need any help.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.