简体   繁体   English

如何使 QR 页脚或带在带详细信息下而不是在页面末尾?

[英]How to make QR Page Footer or Band to be under Band Details not at the page end?

I need to make report, that has summary after Details had printed, not after every each Detail.我需要制作报告,在详细信息打印之后有摘要,而不是在每个细节之后。

I only know the Page Footer, but it's at page bottom not after the Detail Band.我只知道页脚,但它位于页面底部而不是在详细信息带之后。

Is there a QRBand that could go after Detail Band?在Detail Band之后有没有可以QRBand的QRBand? Or can you make PageFooter height resize on every page?或者您可以在每个页面上调整PageFooter的高度吗?

Summary Bands print only at the end of the report immediately after the last 'detail' (unless the AlignToBottom property is set to true ). Summary Bands 仅在最后一个“详细信息”之后的报表末尾打印(除非AlignToBottom属性设置为true )。

You should add a TQRBand to the report and set the BandType property to rbSummary .您应该将TQRBand添加到报告中并将BandType属性设置为rbSummary


EDIT编辑

If you need to show intermediate results on every page you could add the FooterBand and the SummaryBand .如果您需要在每个页面上显示中间结果,您可以添加FooterBandSummaryBand

在此处输入图像描述

Summary Bands prints only at the end of the report (last page) and you can use the BeforePrint event of the summary to disable the footer band. Summary Bands 仅在报告末尾(最后一页)打印,您可以使用摘要的BeforePrint事件禁用页脚区域。


EDIT2编辑2

You can also try with a QRGroupBand and a QRFooterBand .您也可以尝试使用QRGroupBandQRFooterBand

In the GroupBand :GroupBand

  • use the Expression property for separating one group of products from another (the band could also be empty)使用Expression属性将一组产品与另一组产品分开(带区也可以为空)
  • set appropriately the FooterBand property.适当地设置FooterBand属性。 This is where you link the header band to the correct footer band and encapsulate your group inside.这是您将 header 带链接到正确的页脚带并将您的组封装在其中的地方。 Place the header band first and then go back and place the footer band by dropping a QRBand component and immediately changing the Type from rbTitle to rbGroupFooter .首先放置 header 带,然后是 go 放回并放置页脚带,方法是QRBand组件并立即将TyperbTitle更改为rbGroupFooter Once you have done this, you can go back to the QRGroup header and select the right footer band to use.完成此操作后,您可以将 go 返回到QRGroup header 和 select 以使用右页脚带。

The FooterBand is where you are printing summary totals for each product. FooterBand是您打印每个产品的汇总总计的地方。

I was able to solve the problem with the help of quickreport events and datasource events.我能够在快速报告事件和数据源事件的帮助下解决问题。 In a test project, it is enough to put a tqrlabel in the pagefooter, the rest is written below.在一个测试项目中,在pagefooter中放一个tqrlabel就足够了,下面写rest。

type
TForm1 = class(TForm)
  ...
private
  firstValue: Integer;
public
  counter: Integer;
end;

var
  Form1: TForm1;
  PageSummery: Integer;

procedure TForm1.Button2Click(Sender: TObject);
begin
  Application.CreateForm(TForm2, Form2);
  adoquery.First;
  counter := 0;
  firstValue := adoquery.FieldByName('id').AsInteger;
  PageSummery := 0;
  Form2.QuickRep1.Preview;
  Form2.Free;
end;

procedure TForm1.adoqueryAfterScroll(DataSet: TDataSet);
begin
  if counter <= 1 then
    PageSummery := firstValue + adoquery.FieldByName('id').AsInteger
  else
  begin
    PageSummery := PageSummery + adoquery.FieldByName('id').AsInteger;

    form2.QRLabel2.Caption := IntToStr(PageSummery - Form1.adoquery.FieldByName('id').AsInteger);
  end;
counter := counter + 1;
end;

Pay attention to the location of the variables in the first form.注意第一种形式中变量的位置。 The first button is used to fill the query data.第一个按钮用于填充查询数据。 After each increase, the data is placed in the qrlabel so that all the data is saved when the event is triggered.每次增加后,将数据放在 qrlabel 中,以便在触发事件时保存所有数据。 The final point is in the quickreport event, which occurs before filling the print rows when creating a new page.最后一点是 quickreport 事件,它发生在创建新页面时填充打印行之前。 In this event, a number of variables must be set to zero.在这种情况下,必须将许多变量设置为零。

procedure TForm2.QuickRep1StartPage(Sender: TCustomQuickRep);
begin
  if Form1.counter = 0 then
    PageSummery := 0
  else
    PageSummery := Form1.adoquery.FieldByName('id').AsInteger;
end;

Add a GroupHeader and a GroupFooter to the report.GroupHeaderGroupFooter添加到报告中。 Make the Expression on the GroupHeader = PAGENUMBER , and set Height = 0;在 GroupHeader = GroupHeader上创建PAGENUMBER ,并设置 Height = 0; in it's BeforePrint event handler, so that it never shows.在它的BeforePrint事件处理程序中,因此它永远不会显示。 Set the GroupHeader 's FooterBand property to the GroupFooter band.FooterBand GroupHeader设置为GroupFooter带区。 Then put your page totals or whatever on the GroupFooter .然后将您的页面总数或其他内容放在GroupFooter上。 This will print after the detail on every page, and the Summary will print after that on the last page!这将在每一页的详细信息之后打印,而摘要将在最后一页的之后打印!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM