C#_VS2019求助Microsoft.Office.Interop.Excel库的用法
											如题Microsoft.Office.Interop.Excel的用法求助代码如下:
 程序代码:
程序代码:using System;
using System.Collections.Generic;
using Microsoft.Office.Interop.Excel;
namespace OPerateExcel
{
    class Program
    {
        static void Main(string[] args)
        {
            string fileName = @"C:\Users\Administrator\Desktop\test.xlsx";
            string saveName = @"C:\Users\Administrator\Desktop\操作.xlsx";
            //set columns
            Dictionary<string, string> dic = new Dictionary<string, string>();
            dic.Add("订单号", "A");
            dic.Add("数量", "B");
            ApplicationClass excel = new ApplicationClass();//不需要对excel赋值
            Workbook wb = null;//不需要对wb赋值
            excel.Visible = false;
            excel.DisplayAlerts = false;
            wb = excel.Workbooks.Open(fileName);
            Worksheet sht = (Worksheet)wb.Worksheets[1];
            int rowCount = 0;
            rowCount = sht.UsedRange.Rows.Count;
            string orderNum = string.Empty;
            string count = string.Empty;
            //循环行
            for (int i = 0; i < rowCount; i++)
            {
                if (sht.Rows[1] != null)
                {
                    orderNum = sht.Cells[i, dic["订单号"]].ToString();
                    count = sht.Cells[i, dic["数量"]].ToString();
                }
            }
            //循环列
            for (int i = 0; i < sht.UsedRange.Columns.Count; i++)
            {
                //sht.Columns[i];
            }
            wb.Close(wb, saveName);
            Console.ReadKey();
        }
    }
}问题:
ApplicationClass excel = new ApplicationClass();//不需要对excel赋值
这句报错,注释掉这句前面的代码都可以运行,加上这句程序一开始就进入中断模式,前面的代码也没有被执行,点继续执行程序就直接结束了,请大神帮忙看看是什么问题



 
											





 
	    

 
	
