我在asp.net里面打开Excel的文件的源代码 Excel.Application oExcel;
Excel.Workbook oBook;
Object oMissing = System.Reflection.Missing.Value;
oExcel = new Excel.Application();
oBook = oExcel.Workbooks.Open(Server.MapPath(".") + "\\sale_card1.xls",Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing);
for (int i=1;i<=4;i++)
{
oExcel.Cells[i,1]=i.ToString();
oExcel.Cells[i,2]="'bbb2";
oExcel.Cells[i,3]="'ccc3";
oExcel.Cells[i,4]="'aaa4";
}
oBook.Saved = true;
oExcel.UserControl = false;
string mm=Server.MapPath(".")+"\\aa.xls";//服务器保存地址
oExcel.ActiveWorkbook.SaveCopyAs (mm);
oExcel.Quit();
Response.Redirect ("aa.xls");但是上面执行到oExcel.Workbooks.Open(Server.MapPath(".") + "\\sale_card1.xls",Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing); 的时候,页面什么反映也没有,这是怎么回事呢?
Excel.Workbook oBook;
Object oMissing = System.Reflection.Missing.Value;
oExcel = new Excel.Application();
oBook = oExcel.Workbooks.Open(Server.MapPath(".") + "\\sale_card1.xls",Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing);
for (int i=1;i<=4;i++)
{
oExcel.Cells[i,1]=i.ToString();
oExcel.Cells[i,2]="'bbb2";
oExcel.Cells[i,3]="'ccc3";
oExcel.Cells[i,4]="'aaa4";
}
oBook.Saved = true;
oExcel.UserControl = false;
string mm=Server.MapPath(".")+"\\aa.xls";//服务器保存地址
oExcel.ActiveWorkbook.SaveCopyAs (mm);
oExcel.Quit();
Response.Redirect ("aa.xls");但是上面执行到oExcel.Workbooks.Open(Server.MapPath(".") + "\\sale_card1.xls",Type.Missing,Type.Missing,Type.Missing,
Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,Type.Missing,
Type.Missing); 的时候,页面什么反映也没有,这是怎么回事呢?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货