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后空间仍然不足 ...
随机推荐
- ios开发网络学习十:利用文件句柄实现大文件下载
#import "ViewController.h" @interface ViewController ()<NSURLSessionDataDelegate> @p ...
- sysbench压测Oracle
安装: yum -y install make m4 autoconf automake libtool pkgconfig libaio-devel rpm -Uvh http://dl.fedo ...
- Windows Phone 8.1 数据处理
Windows Phone 8.1 应用的数据存储位置包括: Installation Folder ApplicationData Credential Locker Known Folders S ...
- 【34.25%】【BZOJ 2648】SJY摆棋子
Time Limit: 20 Sec Memory Limit: 128 MB Submit: 2718 Solved: 931 [Submit][Status][Discuss] Descrip ...
- 枚举系统磁盘驱动器(使用GetLogicalDriveStrings API函数,system("pause"); 很实用,还用到wcslen等函数)
代码如下: #include "stdafx.h" #include <vector> #include <string> #include <Win ...
- ag
https://github.com/k-takata/the_silver_searcher-win32/releases http://betterthanack.com/https://gith ...
- 【33.33%】【codeforces 552B】Vanya and Books
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 【codeforces 546C】Soldier and Cards
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- PHP基本的文件和文件夹操作常用的汇总
资源:http://www.ido321.com/835.html 一.基本文件的操作 文件的基本操作有:文件推断.文件夹推断.文件大小.读写性推断.存在性推断及文件时间等 1: <?php 2 ...
- 【Cocos2d-x Lua】数据库封装类型的操作
Lua数据库封装类型的操作 使用演示样例 lua代码: require("DB") -- 保存一个字符串(数据库中存储的数据都是以字符串的形式保存的) DB:getInstance ...