0

我正在尝试获取 for 循环中指定的值,然后将它们用作从 Excel 获取的单元格范围。这里出了什么问题?

List<string> str = new List<string>();

        // The follwing increments by 4, and starts at 25

        for (int i = 25; i <= lastRow; i += 4) // += means a + b
        {
            str = ws.Range["B"+i].Value;
         }

...

 SeriesCollection seriesCollection_mySeries = xlChart.SeriesCollection();
 Series series1 = seriesCollection_mySeries.NewSeries();

 series1.Values = str

;

4

1 回答 1

0

我认为您的问题应该得到澄清,但这可能会有所帮助:

for (int i = 25; i <= lastRow; i += 4) // += means a + b
{
    string cellName = "B" + i.ToString();
    string cellValue = (string)ws.Range[cellName].Value;
    str.Add(cellValue);
}
于 2013-02-15T15:24:32.893 回答