Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/264.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用ChartArea时出现问题。请选择方法_C#_Excel_Reflection_Automation - Fatal编程技术网

C# 使用ChartArea时出现问题。请选择方法

C# 使用ChartArea时出现问题。请选择方法,c#,excel,reflection,automation,C#,Excel,Reflection,Automation,我正试图通过C#中的反射使用select方法选择图表区域。这是我正在使用的代码行: oChartArea.GetType().InvokeMember(“选择”,BindingFlags.InvokeMethod,null,oChartArea,null) 这里,oChartArea是ChartArea对象 这在Vista/Office 2007中工作得非常好,但在XP SP2/Office 2003中抛出异常。有什么建议吗 为什么要使用反射? 你不能直接调用oChartArea.Select(

我正试图通过C#中的反射使用select方法选择图表区域。这是我正在使用的代码行:

oChartArea.GetType().InvokeMember(“选择”,BindingFlags.InvokeMethod,null,oChartArea,null)

这里,oChartArea是ChartArea对象


这在Vista/Office 2007中工作得非常好,但在XP SP2/Office 2003中抛出异常。有什么建议吗

为什么要使用反射?
你不能直接调用oChartArea.Select()吗


Office 2003中会出现什么异常?

我正在使用反射使其与Excel 2003和2007兼容。exception语句是:“异常已由调用的目标抛出。”您不需要反射来编写同时适用于两者的代码。