日期:2014-05-17  浏览次数:20889 次

C# WinForm 开发 EXCEL 读入问题
EXCEL 读入代码结构如下:

 try
     {
       using (ExcelComApplication appExcel = new ExcelComApplication())
       {
          …… 处理数据部分
          
         // 当出现数据异常时,直接Return,但是跳出using 特别的慢,数据量大的话得10秒以上才能跳出了
         如:
         //顧客ファイルに必須チェック
                        if (String.IsNullOrEmpty(CustomerNo))
                        {
                            MessageBox.Show(
                                  L4Message.Get("JPE0057"), "ERROR",
                                  MessageBoxButtons.OK, MessageBoxIcon.Error);
                            return;
                        }
          ……
       }
     }
     catch (Exception)
            {
                //ファイルのデータの読込が失敗しました。
                MessageBox.Show(
                               L4Message.Get("JPE0063"), "ERROR",
                               MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }




为什么跳出 using 会特别的慢?
winform excel c#

------解决方案--------------------
慢有很多原因  数据量大 读取EXCEL需要的时间就比较长

------解决方案--------------------
内存消耗过大?!