Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/303.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# excel互操作中的XValue属性_C#_.net_Excel_Interop_Excel Interop - Fatal编程技术网

C# excel互操作中的XValue属性

C# excel互操作中的XValue属性,c#,.net,excel,interop,excel-interop,C#,.net,Excel,Interop,Excel Interop,我想使用Interop更改excel图表中的XValue。 下面是我正在使用的。但它不能识别范围 谁能帮我解决这个问题 chartPage.SetSourceData Range("A2:A4"), xlColumns chartPage.SeriesCollection(1).XValues = Range("B2:B4") 它不是接受范围,无论在哪里我都能找到相同的答案。尝试获取活动工作表并在其上使用范围。大概是这样的: _Worksheet ws = this.Activ

我想使用Interop更改excel图表中的XValue。 下面是我正在使用的。但它不能识别范围

谁能帮我解决这个问题

    chartPage.SetSourceData Range("A2:A4"), xlColumns
    chartPage.SeriesCollection(1).XValues = Range("B2:B4")

它不是接受范围,无论在哪里我都能找到相同的答案。

尝试获取活动工作表并在其上使用范围。大概是这样的:

_Worksheet ws = this.ActiveSheet
chartPage.SeriesCollection(1).XValues = ws.Range("B2:B4")

这看起来像VBA代码,而不是C。这些问题的答案可能会有所帮助