akshay rasalakar

akshay rasalakar

  • 1.5k
  • 128
  • 8.9k

Excel sheet

Aug 31 2015 10:46 AM
string fname = drop.SelectedValue + ".xls";
string namee = fname;
System.IO.FileInfo finfo = new System.IO.FileInfo(fname);
Response.Clear();
Response.AppendHeader("content-type", "application/x-msexcel");
Response.AppendHeader("content-disposition", "attachment; filename=" + drop.SelectedItem.Text + ".xls");
Response.End();
// I have created empty Excel Sheet but the problem is while opening its show me error like the file u r trying to open filename.xls is in a different format than specified by the file extension verify that the file is not corrupted and it from a trusted source before opening the file 

Answers (6)