delphi开发activexObject传递参数的两种方法:

本来要和delphi说再见了,没想到今天还会用到它,这个给无数程序员带来欢乐和泪水的工具,有了你,程序员的世界多彩多资!

delphi开发activexObject传递参数有两种方法:
1,在定义的方法中添加参数,然后在html页面中把参数传递进方法中;
procedure TWebPrint.PrintReportMaterial(const fk_req: WideString);
begin
  showMessage('fk_req:'+fk_req);
  try
    aqyMaterial.Close;
    aqyMaterial.Parameters.ParamByName('fk_req').Value:=m_fk_req;
    aqyMaterial.Open;
  except
    on Exception do showmessage('open material fail');
  end;
  repMaterial.Template.fileName:=ExtractFilePath(Application.ExeName)+'MaterialDetail.rtm';
  repMaterial.print();
end;
页面调用:
var wp=new ActiveXObject("WebPrintProj1.WebPrint");
wp.PrintReportMaterial(pk_id);

2,在接口中添加属性,然后在调用的html页面中把参数传递进对象的属性中;然后
在属性的setProperty(name)中把参数取出来就行了;
procedure TWebPrint.Set_FkReq(const Value: WideString);
begin
  showmessage('setReq:'+value);
  m_fk_req:=value;
end;

页面调用:
var wpPlan=new ActiveXObject("WebPrintProj1.WebPrint");
wpPlan.PkId=pk_id;
wpPlan.PrintReportMaterialPlan();

猜你喜欢

转载自blog.csdn.net/c_huabo/article/details/48290895