private void ExportToExcel(DataTable pdtblData)
{
string strFileData = string.Empty;
byte[] bytFileData = null;
string strfname = string.Empty;
strFileData = GetHTMLData(pdtblData);
strfname = Services.IDGenerator.GetUniqueKeyWithPrefix(_strPerfix, 10) + ".xls";
bytFileData = Encoding.ASCII.GetBytes(strFileData.ToString());
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + strfname);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(bytFileData);
Response.End();
}
{
string strFileData = string.Empty;
byte[] bytFileData = null;
string strfname = string.Empty;
strFileData = GetHTMLData(pdtblData);
strfname = Services.IDGenerator.GetUniqueKeyWithPrefix(_strPerfix, 10) + ".xls";
bytFileData = Encoding.ASCII.GetBytes(strFileData.ToString());
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + strfname);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(bytFileData);
Response.End();
}
No comments:
Post a Comment