2013-02-11 101 views
0

我想使用Interop在Excel表格中更改Xvalues。 以下是我正在使用的。但它不承認Range。XValue propery in excel interop

任何人都可以幫我解決這個問題嗎?

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

它不接受範圍,無處不在我發現同樣的答案。

+0

看起來像VBA代碼而不是C#。 http://stackoverflow.com/questions/175763/resources-for-learning-c-sharp-excel-interop的答案可能有幫助 – barrowc 2013-02-12 02:48:45

回答

0

嘗試獲取活動工作表並在其上使用範圍。類似這樣的:

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