日期:2014-05-20 浏览次数:20751 次
for (int colIndex = 1; colIndex < workSheet.UsedRange.Cells.Columns.Count; colIndex++)//循环读取Excel列
{
ColNum = convertToCharacter(colIndex);
string colomtext = "";
if (workSheet.get_Range(ColNum + "3", Missing.Value).Value2 != null)
{
colomtext = workSheet.get_Range(ColNum + "3", Missing.Value).Value2.ToString(); //获取字母列名称
}
switch (colomtext)//
{
case "&名称":
nameIndex = colIndex;
workSheet.get_Range(ColNum + "3", Missing.Value).Value2 = "名称";
break;
case "&件数":
numIndex = colIndex;
workSheet.get_Range(ColNum + "3", Missing.Value).Value2 = "件数";
break;
case "&数量":
qtyIndex = colIndex;
workSheet.get_Range(ColNum + "3", Missing.Value).Value2 = "数量";