D
DavidC
I am exporting to Excel from a ListView and it works fine except for my extra
text. I am trying to set the font size in an initial response.write text but
it is not working as it outputs it to the default text size of the ListView.
Below is my code to send to Excel. The line in question is the strClient
variable. Thanks.
Sub SendToExcel(ByVal Source As Object, ByVal E As EventArgs) Handles
LBtnExport.Click
Dim lb As Label = Page.Master.FindControl("LblPerson")
Dim strClient As String = "<tr><td style=""font-family: Verdana;
font-size: 20pt;"">" & lb.Text & "</td></tr>"
If PanelYTD.Visible Then
'Exporting YTD Summary
Dim gv As ListView = lvYTDSummary
gv.DataBind()
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=ytdsummary.xls")
Response.Charset = ""
EnableViewState = False
gv.RenderControl(hw)
Response.Write(strClient)
Response.Write(tw.ToString())
Response.End()
gv.DataBind()
End If
End Sub
text. I am trying to set the font size in an initial response.write text but
it is not working as it outputs it to the default text size of the ListView.
Below is my code to send to Excel. The line in question is the strClient
variable. Thanks.
Sub SendToExcel(ByVal Source As Object, ByVal E As EventArgs) Handles
LBtnExport.Click
Dim lb As Label = Page.Master.FindControl("LblPerson")
Dim strClient As String = "<tr><td style=""font-family: Verdana;
font-size: 20pt;"">" & lb.Text & "</td></tr>"
If PanelYTD.Visible Then
'Exporting YTD Summary
Dim gv As ListView = lvYTDSummary
gv.DataBind()
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Response.Clear()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition",
"attachment;filename=ytdsummary.xls")
Response.Charset = ""
EnableViewState = False
gv.RenderControl(hw)
Response.Write(strClient)
Response.Write(tw.ToString())
Response.End()
gv.DataBind()
End If
End Sub