调用EXCEL出错的问题,急
在WebForm下执行到
private void ImportSchoolData(string file)
{
if(File.Exists(file))
{
Excel.Application excel = null;
Excel._Workbook xBook = null;
Excel._Worksheet xSheet = null;
WorkbookClass wBook;
WorksheetClass wSheet;
string path = Path.GetDirectoryName(file);
try
{
excel= new Excel.ApplicationClass();
}
catch(Exception ex)
{
Response.Write("<script>alert('" + ex.Message + "');</script>");
}
xBook = excel.Workbooks.Add(file);
xSheet = (Excel._Worksheet)xBook.ActiveSheet;
的excel= new Excel.ApplicationClass();
就出错,为什么?有谁有Web调用Excel的demo吗??