Rendering GridView and font size


D

David C

I have an ASP.Net page that has a GridView that I am rendering to Excel but
the font size when it goes into Excel is larger. I have the RowStyle on the
GridView to be FontSize = small but when it goes to Excel it is much larger.
How can I set the FontSize when rendering? Thanks.
Below is the code.
-David

Sub SendToExcel()
Dim strSQL As String = txtExcelSQL.Text
Dim gv As GridView = gvLitigationDashboard
If gv.Rows.Count.ToString + 1 < 65536 Then
gv.AllowPaging = False
gv.AllowSorting = False
If strSQL <> "" Then
SqlvwLitigationDashboard.SelectCommand = strSQL
End If
gv.DataBind()
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim strTable As String
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=litdash.xls")
Response.Charset = ""
EnableViewState = False
Response.Write(strTable)
gv.RenderControl(hw)
Response.Write(tw.ToString())
Response.End()
gv.AllowPaging = True
gv.AllowSorting = True
gv.DataBind()
Else
txtMsg.Text = "Too many rows - Export to Excel not possible"
End If
End Sub
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top