I'd like to export a table I have on my webpage to an Excel file and lock some cells in the new file. Here is my current code:
Protected Sub btnExportToExcel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExportToExcel.Click
Response.Clear()
Response.Buffer = True
Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader("content-disposition", "attachment;filename=EpicSearchResults.xls")
Response.Charset = ""
Me.EnableViewState = False
Dim sw As New System.IO.StringWriter()
Dim htw As New System.Web.UI.HtmlTextWriter(sw)
Session("tblResults").RenderControl(htw)
Response.Write(sw.ToString())
Response.End()
End Sub
This code works in generating the Excel file. I've searched for an was unable to find much for a solution to lock cells in the new file. Thanks in advance for the help!