c := TRttiContext.Create; t:=c.GetType(cmp.ClassInfo); p:=t.GetProperty(PropName); if p <> nil then begin IsNumeric:=false; if p.PropertyType.ToString = 'TStrings' then PropValue:=p.GetValue(cmp).AsType.Text else if p.PropertyType.ToString = 'Boolean' then PropValue:=BoolToStr(p.GetValue(cmp).AsBoolean,true) else case p.PropertyType.TypeKind of tkInteger, tkInt64 : begin PropValue := IntToStr(p.GetValue(cmp).AsInteger); IsNumeric:=true; end; tkString, tkUString, tkLString : PropValue := p.GetValue(cmp).AsString; tkFloat : begin PropValue := FloatToStr(p.GetValue(cmp).AsExtended); IsNumeric:=true; end; else PropValue := ''; end; if IsNumeric and (Trim(Copy(st,1,i1-1))='') and (Trim(Copy(st,i2+1,length(st)))='') then Sheet.Cells[Row, Col]:=StrToFloat(PropValue) else Sheet.Cells[Row, Col]:=Copy(st,1,i1-1)+PropValue+Copy(st,i2+1,length(st)); end; c.Free;