Asp.net|excel
Enter the following code in the Click event of the button, which enables you to write to the Excel file.
When you write Excel files, you also set permissions on the project folder, and you have writable permissions for iuser_machine users.
private void Button1_Click (object sender, System.EventArgs e)
{string Filename= "";
Excel.applicationclass oexcel;
oexcel = new Excel.applicationclass ();
oExcel.UserControl = false;
Excel.workbookclass WB = (excel.workbookclass) oExcel.Workbooks.Add (System.Reflection.Missing.Value);
for (int i = 1;i <= 5; i++)
{
Oexcel.cells[i,1]=i.tostring ();
oexcel.cells[i,2]= "' 2nd column";
oexcel.cells[i,3]= "' 3rd column";
oexcel.cells[i,4]= "' 4th column";
}
Wb. Saved = true;
Filename= Request.physicalapplicationpath + "Test.xls";
OExcel.ActiveWorkbook.SaveCopyAs (filename);
oExcel.Quit ();
System.GC.Collect ();
Response.Redirect (Request.applicationpath + "/test.xls");
}