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
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