Excel Interop - 无法更改图表中的Xvalue属性 [英] Excel Interop - Not able to change Xvalue property in chart
本文介绍了Excel Interop - 无法更改图表中的Xvalue属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用Interop更改excel图表中的Xvalues。以下是我正在使用的。但它不承认Range。
有人可以帮我解决这个问题吗?
chartPage.SetSourceData范围( A2:A4),xlColumns
chartPage .SeriesCollection( 1 )。XValues =范围( B2 :B4);
不接受 范围 ,无处不在我找到相同的答案。
谢谢。
解决方案
我已经点击了这之前就这样绕过它...
使用语句更改给它一个别名,例如......
使用 xl = Microsoft.Office.Interop.Excel;
然后在引用Range时使用此别名,例如...
chartPage.SeriesCollection( 1 )。XValues = xl.Range( B2:B4);
I want to change the Xvalues in excel chart using Interop. Following is what I am using. But it is not recognising Range.
Can anybody help me solve this?
chartPage.SetSourceData Range("A2:A4"), xlColumns
chartPage.SeriesCollection(1).XValues = Range("B2:B4");
It is not accepting Range, everywhere I am finding same answer.
Thank you.
解决方案
I''ve hit this before and got around it like this...
Change yourusing
statement to give it an alias, for example ...
using xl = Microsoft.Office.Interop.Excel;
Then use this alias when referring to Range, for example ...
chartPage.SeriesCollection(1).XValues = xl.Range("B2:B4");
这篇关于Excel Interop - 无法更改图表中的Xvalue属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文