Excel连接使用C#抛出错误 - 来自HRESULT的异常:0x800a03ec [英] Excel concatenate using C# throws error - exception from HRESULT: 0x800a03ec

查看:98
本文介绍了Excel连接使用C#抛出错误 - 来自HRESULT的异常:0x800a03ec的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我正在使用C#处理excel文件。



我正在使用excel连接公式,包括逗号和单引号。

但是每次它都会抛出错误 - 来自HRESULT的异常:0x800A03EC。



这是公式:

Sht1.Range [U2]。公式== CONCATENATE(A2,\,\,\TO_DATE(\,B2,\, 'DD-MM-YYYY')\ \,\ C2,\,\ D2,\,\ E2,\,\F2 ,\,\,G2,\,\,);





有趣的是,当我使用连接函数没有太多的复杂性,它的工作原理如下:



Sht1.Range [U2]。公式== CONCATENATE(A2,B2,C2) ,D2,E2,F2,G2);



输出需要逗号和单引号。



我认为第一个公式中的语法不正确。但我无法找到它。有没有其他方法可以写出这样的公式?



任何帮助?



什么我试过了:



简单的公式有效但是当使用逗号和反斜杠时,它会出错。

Hi All,

I am processing an excel file using C#.

I am using excel concatenate formula that includes comma and single quotes.
But everytime it throws the error - Exception from HRESULT: 0x800A03EC.

This is the formula:
Sht1.Range["U2"].Formula = "=CONCATENATE(A2,\",\",\"TO_DATE(\",B2,\",'dd-mm-yyyy')\",\",\",C2,\",\",D2,\",\",E2,\",\"F2,\",\",G2,\",\",)";


Funny that when I use the concatenate function without so much complicacy, it works, like:

Sht1.Range["U2"].Formula = "=CONCATENATE(A2,B2,C2,D2,E2,F2,G2)";

The output requires comma and single quotes.

I think the syntax in first formula is not right. But I am not able to find it out. Is there any other way to write such a formula?

Any help?

What I have tried:

Simple formula works but when comma and backslash are used, it gives error.

推荐答案

我想你可以简单地写如下 -



I think you can simply write it as below -

Sht1.Range["U2"].Formula ="=CONCATENATE(A2," + "TEST" ",B2,C2)"


这篇关于Excel连接使用C#抛出错误 - 来自HRESULT的异常:0x800a03ec的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆