窗体上加上一个frReport1控件
TfrmMain.FlatButton12Click(Sender: TObject);
begin
frVariables['thisanjuan'] :=trim(Edit1.Text)
end;
双击frReport1控件
加入矩形对象
双击矩形对象,输入内容[thisanjuan]
。
给一段我的程序
procedure TfrmMain.FlatButton12Click(Sender: TObject);
var
ssql: string;
begin
begin
if Edit1.Text = '' then
begin
messagebox(Handle, '请输入要打印的的全综号!', '提醒', mb_ok or MB_ICONWARNING);
exit;
end;
if Edit2.Text = '' then
begin
messagebox(Handle, '请输入要打印的的目录号!', '提醒', mb_ok or MB_ICONWARNING);
exit;
end;
if Edit3.Text = '' then
begin
messagebox(Handle, '请输入要打印的的案卷号!', '提醒', mb_ok or MB_ICONWARNING);
exit;
end;
end;
frVariables['thisanjuan'] :=trim(Edit1.Text)+'-'+trim(Edit2.Text)+'-'+trim(Edit3.Text);
ssql := '';
ssql := 'select 文件编号,责任者,正题名,开始时间,页号 from mainwork where (全宗号 = ''' + trim(Edit1.Text) + ''') and (目录号=''' + trim(Edit2.Text) + ''' ) and (案卷号=''' + trim(Edit3.Text) + ''' ) order by 页号 ';
do
adosql(dm1.queryprint, ssql);
frDBDataSet1.DataSet:=dm1.queryprint;
frReport1.LoadFromFile('juannei.frf');
frReport1.ShowReport;
printrizhi.Lines.add(formatdatetime('yyyy', now) + '年' + formatdatetime('mm', now) + '月' + formatdatetime('dd', now) + '日 卷内目录打印,全宗号:' + Edit1.text + ' 目录号:' + Edit2.text + ' 案卷号:' + Edit3.text);
end;