本文介绍了从HRESULT添加公式到单元格异常:0x800A03EC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试向单元格添加一个公式,但是我收到错误
HRESULT的异常:0x800A03EC
有很多类似问题的帖子,但是没有帮助我加上我没有做任何花哨的公式我做错了什么?

I'm trying to add a formula to cell but i got the errorException from HRESULT: 0x800A03ECThere are lots of posts with similar issues however none could help me plus i'm not doing any fancy formula's what i'm doing wrong?

 Thread.CurrentThread.CurrentCulture =
 new System.Globalization.CultureInfo("en-US");
 workbook = application.Workbooks.Open(Helper.GetLocalInstalationFolder() +
             @"\IMC.xltx", 0, false, 5, "", "", true, XlPlatform.xlWindows, "\t", false,
                                                       false, 0, true, 1, 0);
 worksheet = workbook.Worksheets["Report"];
 var rowValue = 0;
 for (int i = 2; i <= LastRow; i++)
 {
     rowValue = i - 1;
     for (int j = 1; j <= 37; j++)
     {
          worksheet.Cells[i, j] = MyArray[rowValue, j];

     }
     // I tried all the following all give the same exception:
     worksheet.Range[i, 38].Formula = "=3+4";
     worksheet.get_Range("R" + i + "C38").FormulaR1C1 = "=3+4";
     worksheet.Range[i, 38].FormulaR1C1 = "=3+4";
     worksheet.get_Range("R" + i + "C38").Formula = "=3+4";
   }


推荐答案

并不意味着任何比您以处理请求的方式砰击Excel的速度更快。您的程序基本上看起来像一个超级用户,以每微秒一位的速度输入公式。

It is a crappy exception and doesn't mean anything more than you slamming Excel with processing requests at a rate that it cannot keep up with. Your program essentially looks like a hyper-active user that's entering formulas at a rate of one per microsecond.

解决方法是通过故意睡觉或强制Excel少做工作在这种情况下,您可能会通过分配属性。在开始将公式放入单元格之前将其设置为手动。在完成之后回到汽车。

The workaround is to go slower by intentionally sleeping or to force Excel to do less work. You will very probably fix it in this case by assigning the Application.Calculation property. Set it to manual before you start putting formulas into cells. And back to auto after you're done.

在。

这篇关于从HRESULT添加公式到单元格异常:0x800A03EC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-29 01:33