delphi7 +fastreport2.5也能输出二维码【原创】

delphi9年前 (2016)发布 admin
674 0
var FRName:string;
    t1:TfrPictureView;

begin  {
 QRCode1.Pxmag := 2;//QRCODE控件名称
  QRCode1.Match := true;
 qrcode1.Stretch:= true;      //图片自适应
qrcode1.version := 4;     //二维码版本,一般4够用了,版本跟保存的数据量有关
  qrcode1.Code:=''//   }

FRName:='sj.frf';//加载模板
  frReport1.LoadFromFile(FRName);//frReport1控件默认name

  t1:=TfrPictureView(frReport1.FindObject('Picture2'));//Picture2是fastreport2.5中图片对象的name值
  if t1<>nil then t1.Picture.Bitmap:=QRCode1.Picture.Bitmap;//最重要的地方传送图片给

  frReport1.ShowReport;

给fastrepost中的memo赋值
TfrxMemoView(frxReport1.FindObject(‘Memo28′)).Memo.Text:=’yes’;

直接赋值给打印模板
在模板中设置memo内容为[cnmd]

procedure TForm1.frprt1GetValue(const ParName: string; var ParValue: Variant);
begin

  if ParName = 'cnmd' then
    ParValue := '55750596';

end;

直接打印和预览打印

 
 frprt1.LoadFromFile('sj.frf'); //加载报表
  if rb2.Checked then
  begin
//预览打印
    if frprt1.PrepareReport then
      frprt1.ShowPreparedReport;
  end
  else
  begin
//直接打印
    frprt1.PrepareReport;
    frprt1.PrintPreparedReport('', 1, true, frAll);
  end;

将程序中的图片赋值给打印模板,方式二  
(frxReport1.FindObject('picture1') as TfrxPictureView).Picture.LoadFromFile('d:\c.jpg');

© 版权声明

相关文章