Hi,
I generated excel file using this below code. I am getting left navigation, top navigation (all contents in a page) are coming in the excel file. I want to generate the excel file only with whatever controls I created. Anyone help in this?
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
HttpContext.Current.Response.ContentType = "application/vnd.xls"
ScriptManager
.RegisterStartupScript(btnExcel, this.GetType(), "call me", "ExcelPanel()", true);
function ExcelPanel() {
var panel = document.getElementById("<%=updatepanelPrint %>");
var excelWindow = window.open('', '', 'height=1500,width=800', 'scrollbars=yes');
excelWindow.document.write(
'<html><head><meta http-equiv=Content-Type content=:' + '"' + "text/html; charset=utf-8" + '"' + '>');
excelWindow.document.write(
'</head><body >');
excelWindow.document.write(panel.innerHTML);
excelWindow.document.write(
'</body></html>');
excelWindow.document.close();
return false;
}