QuickReport的OnNeedData的触发情况
1、设置QuickReport的DataSet为空。
2、在QuickReport的BeforePrint里面将要显示的数据集合初始化,如Query1.First;
3、在OnNeedData里面写代码,同时设置MoreData的状态、移动数据集合
如:QrLabel1.Caption:=Query1.FieldByName('Col1').AsString;
Query1.Next;
MoreData:=Not Query1.Eof;
这样就OK了!
https://wedelphi.com/t/92391/
quickreport 的 OnNeedData:
procedure TForm1.QuickRep1NeedData(Sender: TObject;
var MoreData: Boolean);
begin
moredata:=true;
if not table1.Eof then
begin
begin
qrlabel1.Caption := table1.fieldbyname('Name').AsString;
//subDetail中要显示的数据
qrlabel2.Caption := table1.fieldbyname('Age').AsString;
end;
table1.Next;
end
else
//每页显示五行,不足用空行补齐
if nRow < 5 then
begin
qrlabel1.Caption := '';
qrlabel2.Caption := '';
end;
if nRow = 5 then
begin
moredata := false;
table1.First;
nRow := 0;
end;
Inc(nRow);
end;
https://wedelphi.com/t/302356/
如果你有quickreport的源代码可以这样改造,下面代码是需要加入的。
由于这里不一定说的清楚,你如果写过控件可以自己改造,代码就这些,
如果不行可以和我单独交流: TQrCustomController = class(TComponent) {控制}
private
FDetailPerPage: integer;
procedure SetDeatilPerPage(APerPage: integer);
public
property DetailPerPage: integer read FDetailPerPage write SetDeatilPerPage;
end;
TCustomQrReport = class(TQrBasePanel)
private
FDetailPerPage: integer;
procedure SetDeatilPerPage(APerPage: integer);
public
procedure PrintBandchildNone(ABand: TNoteCustomBand); {打印但没有孩子}
property DetailPerPage: integer read FDetailPerPage write SetDeatilPerPage;
end;
procedure TCustomNotePaint.PrintBandchildNone(ABand: TNoteCustomBand);
{打印但没有孩子}
var
dmy: integer;
begin
if ABand <> nil then
begin
if ABand.AlignToBottom then
begin
if Page.Orientation = poPortrait then
dmy := round(QRPrinter.PaperLength - Page.BottomMargin -
ABand.Size.Length - FPageFooterSize)
else
dmy := round(QRPrinter.PaperWidth - Page.BottomMargin -
ABand.Size.Length - FPageFooterSize);
if dmy > CurrentY then
CurrentY := dmy;
end;
ABand.PrintNoChild;
end;
end;
//加入固定数目的空白行procedure TQrController.PrintBlankFooter(Anum: integer);
var
I, j: integer;
TmpBand: TNoteband;
TmpColor: tColor;
begin
if Anum = 0 then
exit;
if Anum = FDetailPerPage then
exit;
TmpBand := TQrBand.Create(FParentReport);
TmpBand.BandType := rbSummary;
TmpBand.Frame.DrawLeft := true;
TmpBand.Frame.DrawRight := true;
TmpBand.Frame.DrawBottom := true;
if ((FDetail <> nil) and (FDetail.ControlCount > 0)) then
TmpColor := TQrCustomLabel(FDetail.Controls[0]).Font.Color;
for I := Anum - 1 downto 0 do
begin
for j := 0 to FDetail.ControlCount - 1 do
begin
TQrCustomLabel(FDetail.Controls[j]).Font.Color := FDetail.Color;
{颜色为底色}
end;
FParentReport.PrintBandchildNone(FDetail);
{有效但造成了最后一条记录的重复计算,修改后已经解决}
for j := 0 to FDetail.ControlCount - 1 do
begin
TNoteCustomLabel(FDetail.Controls[j]).Font.Color := TmpColor;
end;
end;
TmpBand.Free;
end;
///Suny modified 2000.3.15 one functionprocedure TQrCustomController.SetDeatilPerPage(APerPage: integer);
begin
FDetailPerPage := APerPage;
end;///Suny modified 2000.3.15 one functionprocedure TCustomQrReport.SetDeatilPerPage(APerPage: integer);
begin
FDetailPerPage := APerPage;
Controller.DetailPerPage := AperPage;
end;
在procedure TQrController.Execute;函数中找到:
ParentReport.QRPrinter.Progress := (Longint(DetailNumber) * 100) div
RecCount;
一句,在其后加入
if FDetailPerPage <> 0 then
begin
if (FDetailNumber mod FDetailPerPage) = 0 then
begin
if assigned(FFooter) then
begin
if (SelfCheck is TCustomNotePaint) and
FFooter.AlignToBottom then
;
// ParentReport.FPageFooterSize := 0;
if (FFooter <> nil) and (ParentReport.PageNumber = 0) then
ParentReport.NewPage;
ParentReport.PrintBand(FFooter);
end;再找到:
CheckLastGroupFooters;
PrintGroupFooters;
if assigned(FFooter) then
begin
if (SelfCheck is TCustomNotePaint) and
FFooter.AlignToBottom then
;
在其前加入:
if FDetailPerPage <> 0 then
if detailNumber = RecCount then
PrintBlankFooter(FDetailPerPage - (RecCount mod FDetailPerPage));
http://www.debugease.com/delphi/4231392.html
QuickReport的OnNeedData的触发情况的更多相关文章
- 关于Application_End 与 Application_Start事件触发情况的测试(待续)
测试项目搭建 定义一个简单的Mvc项目,有如下文件: (1) public class Startup { public void Configuration(IAppBuilder app) { a ...
- 触发Full GC执行的情况
除直接调用System.gc外,触发Full GC执行的情况有如下四种. 1. 旧生代空间不足 旧生代空间只有在新生代对象转入及创建为大对象.大数组时才会出现不足的现象,当执行Full GC后空间仍然 ...
- GC之三--GC 触发Full GC执行的情况及应对策略
1.System.gc()方法的调用 此方法的调用是建议JVM进行Full GC,虽然只是建议而非一定,但很多情况下它会触发 Full GC,从而增加Full GC的频率,也即增加了间歇性停顿的次数. ...
- 触发JVM进行Full GC的情况及应对策略
堆内存划分为 Eden.Survivor 和 Tenured/Old 空间,如下图所示: 从年轻代空间(包括 Eden 和 Survivor 区域)回收内存被称为 Minor GC,对老年代GC称为M ...
- 触发Full GC执行的情况 以及其它补充信息
除直接调用System.gc外,触发Full GC执行的情况有如下四种.1. 旧生代空间不足旧生代空间只有在新生代对象转入及创建为大对象.大数组时才会出现不足的现象,当执行Full GC后空间仍然不足 ...
- GC之八--GC 触发Full GC执行的情况及应对策略
目录: GC之一--GC 的算法分析.垃圾收集器.内存分配策略介绍 GC之二--GC日志分析(jdk1.8)整理中 GC之三--GC 触发Full GC执行的情况及应对策略 gc之四--Minor G ...
- java触发full gc的几种情况概述
前言 近期被问及这个问题,在此记录整理一下. System.gc()方法的调用 此方法的调用是建议JVM进行Full GC,虽然只是建议而非一定,但很多情况下它会触发 Full GC,从而增加Full ...
- Delphi ComboBox的属性和事件、及几个鼠标事件的触发
临时做了两个小的测试程序,为了彻底弄清楚combobox的OnClick.OnChange.OnDropDown.OnCloseUp.OnSelect事件的触发及其先后顺序. 另附常用鼠标事件的触发情 ...
- JVM-触发Full GC的情况
除直接调用System.gc外,触发Full GC执行的情况有如下四种: 1.老年代空间不足 老年代空间只有在新生代对象转入及创建为大对象.大数组时才会出现不足现象,当执行Full GC后空间仍然不足 ...
随机推荐
- AVR第5课:蜂鸣器
下面是蜂鸣器的电路图. 代码:蜂鸣器代码. <span style="font-size:18px;">/* *info:buzzer *author:chenlu * ...
- iOS开发NSOperation 三:操作依赖和监听以及线程间通信
一:操作依赖和监听 #import "ViewController.h" @interface ViewController () @end @implementation Vie ...
- php实现 统计输入中各种字符的个数
php实现 统计输入中各种字符的个数 一.总结 一句话总结:谋而后动,想清楚,会非常节约编写代码的时间. 1.对结果可能是0的变量,记得初始化? 4 $len=0; 5 $len=strlen($st ...
- php实现求最小的k个数(日常出错很容易是分号或者$符号忘记写了)
php实现求最小的k个数(日常出错很容易是分号或者$符号忘记写了) 一.总结 日常出错很容易是分号或者$符号忘记写了 二.php实现求最小的k个数 题目描述 输入n个整数,找出其中最小的K个数.例如输 ...
- [内核编程] Windebug双机调试环境搭建
Windebug双机调试环境搭建 开始进行内核编程/驱动编程的调试工作是非常烦人的,由于程序运行与内核层不受操作系统的管控,所以容易引起主机蓝屏和崩溃是常有的事.这也就使得内核程序的调试成了一大 ...
- Android MediaScanner使用简单介绍
1. 运行扫描 仅仅有系统开机的时候才会运行MediaScanner,其他情景下须要手动运行扫描(拍摄,下载等). 手动运行扫描的方法是发送MediaScanner广播: 1.1 扫描指定文件: In ...
- iOS过场动画调研笔记
前言 因项目须要,近期一段时间都在调研iOS的过场动画.对于我来说这是一个之前没有太涉及的领域,所以有必要把调研的过程和自己的一些理解纪录下来 为什么要自己定义过场动画? 假设大家有关注Materia ...
- Facial keypoints detection Kaggle 竞赛系列
3.2# Facial keypoints detection 作者:Stu. Rui QQ: 1026163725 原文链接:http://blog.csdn.net/i_love_home/art ...
- C#生成二维码,把二维码图片放入Excel中
/// <summary> /// 把图片保存到excel中 /// </summary> /// <param name="excelFilePath&quo ...
- 基于PCM2912a的USB声卡设计
将近一年时间没有做过硬件了,感觉都不会用Altium Designer软件了.这次做这个USB 声卡有两个目的,其一是复习Altium Designer软件:其二是在业余时间找个事做做,打发一下自己的 ...