Пример #1
0
 private List<string> Test(Excel.SeriesCollection sc)
 {
     List<string> res = new List<string>();
     for (int i = 1; i <= sc.Count; i++)
     {
         string seriesFormula = sc.Item(i).Formula;
         int firstComma = seriesFormula.IndexOf(',');
         int secondComma = seriesFormula.IndexOf(',', firstComma + 1);
         int thirdComma = seriesFormula.IndexOf(',', secondComma + 1);
         string yValues = seriesFormula.Substring(secondComma + 1, thirdComma - secondComma - 1);
         Excel.Range yRange = ws.get_Range(yValues, nullobj);
         for (int j = 1; j <= yRange.Cells.Count; j++)
         {
             Excel.Range cell = (Excel.Range)yRange.Cells[j, nullobj];
             res.Add(cell.Value2.ToString());
         }
     }
     return res;
 }