procedure RMSetStrProp(aObject: TObject; const aPropName: string; ID: Integer);
var
  lStr: string;
  lPropInfo: PPropInfo;
begin
  lStr := RMLoadStr(ID);
  if lStr <> '' then
  begin
    lPropInfo := GetPropInfo(aObject.ClassInfo, aPropName);
    if lPropInfo <> nil then
      SetStrProp(aObject, lPropInfo, lStr);
  end;
end;

function RMGetPropValue(aReport: TRMReport; const aObjectName, aPropName: string): Variant;
var
  pi: PPropInfo;
  lObject: TObject;
begin
  Result := varEmpty;
  if aReport <> nil then
    lObject := RMFindComponent(aReport.Owner, aObjectName)
  else
    lObject := RMFindComponent(nil, aObjectName);

  if lObject <> nil then
  begin
    pi := GetPropInfo(lObject.ClassInfo, aPropName);
    if pi <> nil then
    begin
      case pi.PropType^.Kind of
        tkString, tkLString, tkWString:
          Result := GetStrProp(lObject, pi);
        tkInteger, tkEnumeration:
          Result := GetOrdProp(lObject, pi);
        tkFloat:
          Result := GetFloatProp(lObject, pi);
      end;
    end;
  end;
end;

 

 posted on 2015-11-02 11:15  宝兰  阅读(312)  评论(0编辑  收藏  举报