根据表中的编号判断,当编号是“****“时将其内容赋给表头组件,遇到下一四个星号之间的内容在detailband中打印,并再遇到下四个星号时换页。
例数据格式形如:
bh mc dw .......
**** ddd m2 .......//要求在pageHeaderband中打印
0001 d001 m2 .......//在detailband中打印
。。
**** ddd m2 .......//要求在pageHeaderband中打印,这时应换页
0001 d001 m2 .......//在detailband中打印
。。
例数据格式形如:
bh mc dw .......
**** ddd m2 .......//要求在pageHeaderband中打印
0001 d001 m2 .......//在detailband中打印
。。
**** ddd m2 .......//要求在pageHeaderband中打印,这时应换页
0001 d001 m2 .......//在detailband中打印
。。
解决方案 »
- 如何将表1中学号列 更新到表2的学号列
- CodeGear大幅揭露Delphi和C++Builder未來的發展方向! (自李维blog)
- 如何将磁盘中的图片文件保存到access表中的ole字段?急
- 怎么才能知道数据控件的SQL语句执行的情况呢??我的分全送光了对不起大家了|!
- 有没有不用连接数据库就能直接在代码中插入多条记录的TDATASET
- 急,关于向串口发送二进制数据的问题?
- table.filter:='state'+'='+'''hi''',为什么前面的state只需要一个单引号,但后面的HI需要三个
- 关于stringgrid的问题
- ????高手:delphi6中如何实现接口的包容与聚合????
- 用Delphi拦截Windows系统消息
- 如何自动取得汉字的拼音缩写?(如汉字---hz)
- ADOConnection问题
先声明一个变量varTempName : string;调用报表预览procedure TForm1.Button1Click(Sender: TObject);beginquery1.Close;query1.Open;TempName := query1.fieldbyname('name').AsString;QuickRep1.Preview;end;调用DetailBand的BeforePrint方法procedure TForm1.DetailBand1BeforePrint(Sender: TQRCustomBand;var PrintBand: Boolean);beginif Query1.FieldByName('Name').AsString <>TempName thenbeginquickrep1.NewColumn;tempname := query1.fieldbyname('name').Asstring;end;end;
MoreData:=true;
with datamodule1.Query3 do
begin //next;
if(copy(trim(fieldbyname('bh').AsString),1,4)='****') then
begin
//nbPrint:=false;
if nRowH=0 then
begin showmessage('cc');
QRLabel13.Caption:=trim(copy(trim(fieldbyname('bh').AsString),5,16));
next;
bPrint:=true;
nbPrint:=false;
end
else
begin showmessage(inttostr(nRowH)); //如不满一页时补充空格
for j:=1 to strcols do
begin
TQRRichText( self.FindComponent('QRRichText'+inttostr(j+24))).Lines.clear;
QRRichText48.Lines.Clear;
DetailBand1.Height:=22+IncRowHeight;
QRShape53.Height:=22+IncRowHeight;
QRShape51.Top:=DetailBand1.Height-2;
TQRShape(self.FindComponent('QRShape'+inttostr(25+j))).Height:=22+IncRowHeight;
end;
bPrint:=false;
nbPrint:=true;
end;
end;
DetailBand1.Height:=DefaultDetailHeight;
QRShape51.Top:=DetailBand1.Height-2;
QRShape53.Height:=DetailBand1.Height;
if not eof then
begin
if bPrint then // if bPrint then
begin //showmessage(inttostr(nrowh));
//nbPrint:=true;
PrintRowData()
end;
end;
nRowH:=nRowH+DetailBand1.Height;
if eof then
begin
if isfull then
begin
for j:=1 to strcols do
begin
TQRRichText(self.FindComponent('QRRichText'+inttostr(j+24))).Lines.clear;
QRRichText48.Lines.Clear;
DetailBand1.Height:=22+IncRowHeight;
QRShape53.Height:=22+IncRowHeight;
QRShape51.Top:=DetailBand1.Height-2;
TQRShape(self.FindComponent('QRShape'+inttostr(25+j))).Height:=22+IncRowHeight;
end;
if nRowH>=PrintHeight then
MoreData:=false;
end
else
MoreData:=false;
end;
if bPrint then
Next;
end;