for (int i = 0; i < 24;)
{
var cell = table2[1, i];
var rangType = companyScheme[i];
string txtCell = "";
switch (rangType)
{
case 1: txtCell = "尖"; break;
case 2: txtCell = "峰"; break;
case 3: txtCell = "平"; break;
case 4: txtCell = "谷"; break;
}
cell.AddParagraph().AppendText(txtCell);
int end = DD(i, companyScheme);
table2.ApplyHorizontalMerge(1, i, end);
i += end - i + 1;
}
public static int DD(int i, Dictionary<int, int> companyScheme)
{
if(i == 23)
{
return 23;
}
if(companyScheme[i]== companyScheme[i + 1])
{
return DD( i +1, companyScheme);
}
else
{
return i;
}
}