我想将我在网页上的表格导出到Excel文件并锁定新文件中的一些单元格.这是我目前的代码:
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