How do I get an Excel range using row and column numbers in VSTO / C#?

后端 未结 9 1943
萌比男神i
萌比男神i 2020-12-05 13:07

I think the question sums it up. Given two integers for row and column or four integers for row and column for the two corners of a range, how do I get a range object for th

9条回答
  •  日久生厌
    2020-12-05 13:49

    Try this, works!

    Excel.Worksheet sheet = xlWorkSheet;
    Excel.Series series1 = seriesCollection.NewSeries();
    Excel.Range rng = (Excel.Range)xlWorkSheet.Range[xlWorkSheet.Cells[3, 13], xlWorkSheet.Cells[pp, 13]].Cells;
    series1.Values = rng;
    

提交回复
热议问题