如何实现打印成卡片的方式(0分)

  • 主题发起人 主题发起人 chxii
  • 开始时间 开始时间
C

chxii

Unregistered / Unconfirmed
GUEST, unregistred user!
如何用DELPHI实现把打印方式,实现成卡片方式
就是在一章打印纸张上边,把要打印的文字划分开来
 
可以用报表工具进行制作:接下来的代码是用QUICKREPORT组件演示
在制作卡片菜单时,先设置一下卡片标题:
with datam1do
begin
q_s_department.close;
q_s_department.open;
if q_s_department.fieldbyname('state1').asstring='1' then
dwmc.caption:='µ¥Î»£º'+q_s_department.fieldbyname('name').asstring;
if q_s_xxk.active then
if q_s_xxk.recordcount>0 then
begin
quickrep1.preview;
end;
end;
end;
然后是:
procedure TFrm_yqk.BitBtn2Click(Sender: TObject);
begin
{with datam1do
begin
q_s_department.close;
q_s_department.open;
if q_s_department.fieldbyname('state1').asstring='1' then
dwmc1.caption:='µ¥Î»£º'+q_s_department.fieldbyname('name').asstring;
if q_s_xxk.active then
if q_s_xxk.recordcount>0 then
begin
quickrep2.print;
end;
end;
}
try
Query_All.close;
Query_All.sql.clear;
Query_All.Sql.Add('delete from bqtemp');
//Çå¿ÕÁÙʱ¿â
bqtemp
Query_All.ExecSQL ;
except //Èç¹ûûÓÐÔò´´½¨
Query_All.sql.clear;
Query_All.Sql.Add('Create Table bqtemp(classifyno VarChar(15),Fixtureno VarChar(15) ,name VarChar(50) , office VarChar(50) ,classifyno1 VarChar(15),Fixtureno1 VarChar(15) ,name1 VarChar(50) , office1 VarChar(50) ,');
Query_All.Sql.Add('classifyno2 VarChar(15),Fixtureno2 VarChar(15) ,name2 VarChar(50) , office2 VarChar(50))');
Query_All.ExecSQL ;
end;
Q_s_xxk.Active;
Q_s_xxk.First;
while not Q_s_xxk.Eofdo
begin
Query_All.sql.clear;
Query_All.Sql.Add('insert into bqtemp(classifyno,fixtureno,name,office,classifyno1,fixtureno1,name1,office1,classifyno2,fixtureno2,name2,office2)');
Query_All.Sql.Add('values (:classifyno,:fixtureno,:name,:office,:classifyno1,:fixtureno1,:name1,:office1,:classifyno2,:fixtureno2,:name2,:office2)');
Query_All.ParamByName('classifyno').asstring:=Q_s_xxk.fieldbyname('classifyno').asstring;
Query_All.ParamByName('fixtureno').asstring:=Q_s_xxk.fieldbyname('fixtureno').asstring;
Query_All.ParamByName('name').asstring:=Q_s_xxk.fieldbyname('name').asstring;
Query_All.ParamByName('office').asstring:=trim(copy(Q_s_xxk.fieldbyname('office').asstring,8,50));
Q_s_xxk.Next;
if Q_s_xxk.Eof then
begin
Query_All.ParamByName('classifyno1').asstring:='';//Q_s_xxk.fieldbyname('classifyno').asstring;
Query_All.ParamByName('fixtureno1').asstring:='';
Query_All.ParamByName('name1').asstring:='';
Query_All.ParamByName('office1').asstring:='';
Query_All.ParamByName('classifyno2').asstring:='';//Q_s_xxk.fieldbyname('classifyno').asstring;
Query_All.ParamByName('fixtureno2').asstring:='';
Query_All.ParamByName('name2').asstring:='';
Query_All.ParamByName('office2').asstring:='';
Query_All.ExecSQL ;
break;
end
else
begin
Query_All.ParamByName('classifyno1').asstring:=Q_s_xxk.fieldbyname('classifyno').asstring;
Query_All.ParamByName('fixtureno1').asstring:=Q_s_xxk.fieldbyname('fixtureno').asstring;
Query_All.ParamByName('name1').asstring:=Q_s_xxk.fieldbyname('name').asstring;
Query_All.ParamByName('office1').asstring:=trim(copy(Q_s_xxk.fieldbyname('office').asstring,8,50));
end;

Q_s_xxk.Next;
if Q_s_xxk.Eof then
begin
Query_All.ParamByName('classifyno2').asstring:='';//Q_s_xxk.fieldbyname('classifyno').asstring;
Query_All.ParamByName('fixtureno2').asstring:='';
Query_All.ParamByName('name2').asstring:='';
Query_All.ParamByName('office2').asstring:='';
Query_All.ExecSQL ;
break;
end
else
begin
Query_All.ParamByName('classifyno2').asstring:=Q_s_xxk.fieldbyname('classifyno').asstring;
Query_All.ParamByName('fixtureno2').asstring:=Q_s_xxk.fieldbyname('fixtureno').asstring;
Query_All.ParamByName('name2').asstring:=Q_s_xxk.fieldbyname('name').asstring;
Query_All.ParamByName('office2').asstring:=trim(copy(Q_s_xxk.fieldbyname('office').asstring,8,50));
end;
Query_All.ExecSQL ;
Q_s_xxk.Next;
end;
q_bqsel.close;
q_bqsel.open;
quickrep5.preview;
end;

这里面是对表里面的三个字段进行打印,其他的舍去!而且创建的临时表只是个容器,在系统中没有实际的意义!
 
以前的DELPHIBBS号,丢了,再注册一个来这里耍耍,
有兴趣的DELPHI爱好者,加我QQ381786877 87219720,
成交好友,共同磨刀。群9732507 不是灌水,只为交友!!
 
后退
顶部