Delphi FastReport动态向指定控件填入内容

constructor TPrinter.Create(sFileName: string);
begin
  frxReport := TfrxReport.Create(nil);
  frxReport.LoadFromFile(sFileName, True);
  frxReport.PrintOptions.Printer := sPrinterName;  //设置指定打印机 'BOSHI BS-280K'
  frxReport.OnBeforePrint := frxReport1BeforePrint;
end;

procedure TPrinter.frxReport1BeforePrint(Sender: TfrxReportComponent);
var
  sTemp: string;
begin
  if (Sender is TfrxMemoView) then
  begin
    if ((Sender as TfrxMemoView).Name = 'Memo_FPHM') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FFPHM
    else if ((Sender as TfrxMemoView).Name = 'Memo_JQBH') then
      (Sender as TfrxMemoView).Memo.Text := Card.JSPBH
    else if ((Sender as TfrxMemoView).Name = 'Memo_XFMC') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FXFMC
    else if ((Sender as TfrxMemoView).Name = 'Memo_XFSH') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FXFSH
    else if ((Sender as TfrxMemoView).Name = 'Memo_GFMC') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FGFMC
    else if ((Sender as TfrxMemoView).Name = 'Memo_GFSH') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FGFSH
    else if ((Sender as TfrxMemoView).Name = 'Memo_KPRQ') then
      (Sender as TfrxMemoView).Memo.Text := FormatDateTime('yyyy年MM月dd日', Now)
    else if ((Sender as TfrxMemoView).Name = 'Memo_SKR') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FSKR
    else if ((Sender as TfrxMemoView).Name = 'Memo_JSHJ') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FHJJE
    else if ((Sender as TfrxMemoView).Name = 'Memo_JSHJDX') then
    begin
      TransMoney(StrToFloat(Inv.FHJJE), sTemp);
      (Sender as TfrxMemoView).Memo.Text := sTemp //转大写
    end
    else if ((Sender as TfrxMemoView).Name = 'memo_FWM') then
      (Sender as TfrxMemoView).Memo.Text := Inv.FFWM
    else
    begin
      sTemp:= (Sender as TfrxMemoView).Name;
      (Sender as TfrxMemoView).Memo.Text :=GetValue(sTemp);
    end;
  end
  else if (Sender is TfrxBarCodeView) then
  begin
    if ((Sender as TfrxBarCodeView).Name = 'bcFWM') then
      (Sender as TfrxBarCodeView).Text := Inv.FFWM;
  end;
end;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值