case arr_zdzwmc[col] of               //先以Excel第二行为例
        '性别':       strValue:=changeXB(WorkSheet[2,col]);
        '名族':       strValue:=changeMZ(WorkSheet[2,col]);
        '证件类型':   strValue:=changeZJLX(WorkSheet[2,col]);
        '是否院士':   strValue:=changeIS_NOT(WorkSheet[2,col]);
        '党派':       strValue:=changeDP(WorkSheet[2,col]);
        '最高学位':   strValue:=changeXW(WorkSheet[2,col]);
        '职称':       strValue:=changeZC(WorkSheet[2,col]);
        '文化程度':   strValue:=changeWP(WorkSheet[2,col]);
        '是否博导':   strValue:=changeIS_NOT(WorkSheet[2,col]);
        '区域代码':   strValue:=changeQY(WorkSheet[2,col]);
        '省份代码':   strValue:=changeSF(WorkSheet[2,col]);
        '推荐单位':   strValue:=getTjdwID(WorkSheet[2,col]);
        '工作单位':   strValue:=getGzdwID(WorkSheet[2,col]);
        '熟悉学科1':  strValue:=changeSXXK(WorkSheet[2,col]);
        '熟悉学科2':  strValue:=changeSXXK(WorkSheet[2,col]);
        '熟悉学科3':  strValue:=changeSXXK(WorkSheet[2,col]);
      else
        strValue:=WorkSheet[2,col];
end;上面是一段代码,arr_zdzwmc[]数组存放的是string类型的值,strValue为string;右面小函数都是返回string类型的一个值,程序运行的错误提示是:   [Error] Unit_zj_ExcelDR.pas(899): Incompatible types: 'Integer' and 'String' ,请问这是怎么回事啊?
      

解决方案 »

  1.   

    pascal语法中的 case 只支持integer类型的,你可以相应的作一下转换
      

  2.   

    case col of              //先以Excel第二行为例 
            0:      strValue:=changeXB(WorkSheet[2,col]); 
            1:      strValue:=changeMZ(WorkSheet[2,col]); 
            2:  strValue:=changeZJLX(WorkSheet[2,col]); 
            3:  strValue:=changeIS_NOT(WorkSheet[2,col]); 
            4:      strValue:=changeDP(WorkSheet[2,col]); 
            5:  strValue:=changeXW(WorkSheet[2,col]); 
            6:      strValue:=changeZC(WorkSheet[2,col]); 
            7:  strValue:=changeWP(WorkSheet[2,col]); 
            8:  strValue:=changeIS_NOT(WorkSheet[2,col]); 
            9:  strValue:=changeQY(WorkSheet[2,col]); 
            10:  strValue:=changeSF(WorkSheet[2,col]); 
            11:  strValue:=getTjdwID(WorkSheet[2,col]); 
            12:  strValue:=getGzdwID(WorkSheet[2,col]); 
            13:  strValue:=changeSXXK(WorkSheet[2,col]); 
            14:  strValue:=changeSXXK(WorkSheet[2,col]); 
            15:  strValue:=changeSXXK(WorkSheet[2,col]); 
          else 
            strValue:=WorkSheet[2,col]; 
    end;