I am exporting a gridview to Excel using the code below. One of the columns contains line breaks. How do I export those line breaks to Excel? When I run the code each line break creates a new row.
Code:
If gvResults.Rows.Count > 0 Then
gvResults.AllowPaging = False
gvResults.AllowSorting = False
gvResults.Columns(0).Visible = False
gvResults.Columns(13).Visible = True
PopulateSearch("DateEntered DESC")
PopulateResponseJustification()
Dim Style As String = "<style>.text { mso-number-format:\@; } </style>"
Dim tw As New StringWriter()
Dim hw As New System.Web.UI.HtmlTextWriter(tw)
Dim frm As HtmlForm = New HtmlForm()
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=Export.xls")
Response.Charset = ""
EnableViewState = False
Controls.Add(frm)
frm.Controls.Add(gvResults)
frm.RenderControl(hw)
Response.Write(style)
Response.Write(tw.ToString())
Response.End()
gvResults.AllowPaging = True
gvResults.AllowSorting = True
gvResults.Columns(0).Visible = True
gvResults.Columns(13).Visible = False
PopulateSearch("DateEntered DESC")
End If