2

我需要在 Delphi 5 中创建一个 QuickReport,其布局如下:

+================
| Report Header
+================

+=========================================
| Detail Band (auto-stretching, repeats)
.
+=========================================
   |    Child band (fixed-size)
   +======================================
   |    Child band (Auto-stretching)
   .    
   +======================================
   |    Child band (fixed-size)
   +======================================

+=================================
| Report Footer (auto-stretching)
. 
+=================================

+==================================
| Report Footer (auto-stretching)
. 
+==================================

+=============================
| Report Footer (fixed size)
+=============================

任何人都可以想出标题,详细信息,子,页脚,子详细信息,组标题,组页脚带的组合 - 以及它们之间相关的父,主,报告,查询链接,这样我就可以制作报告我需要看吗?

不要混淆我对术语的使用

  • 头带
  • 细节带
  • 儿童乐队
  • 页脚带

暗示任何乐队都必须是那些实际的类型。我在概念意义上使用这些术语:

  • 整个报告开头的单个带区(报告标题)
  • 由四个乐队组成的重复组
  • 在所有细节之后出现的三个带,前两个是自动拉伸的

同样的问题,只是更长

+===========================================
| Suspicious Transaction Report
|   STR No.: 12345
|      Date: 11/28/1973
|
|   Comments: as per NSL 1/13/2010
+===========================================

+===========================================
| Transaction 1 of 7
|      Buy                  Sell
|     $100.00            $16,000.00
|                        $27,000.00
|                        $12,000.00
.                            ...
+===========================================
|  Customer Information
|           Name: Shelby Lake
|        Address: 11111 S NC-HWY 111
|            DOB: 6/19/1981
|         ID No.: G123-456-789
|     Occupation: waitress
+===========================================
|  Original Transaction
|       Buy                 Sell
|      $100.00           $16,000.00
|    $3,000.00           $27,000.39
|   $64,132.69           $12,000.13
.       ...                  ...
+===========================================
|  Third Party Information
|           Name: Yugo Chavez
|        Address: 11111 S AB
|            DOB: 9/15/1934
|         ID No.: 995-1935
|     Occupation: dictator
+===========================================

...

+===========================================
| Transaction 7 of 7
.
.
+===========================================

+===========================================
| Description of Suspicious Activity
|   Customer had beedy eyes, that moved
|   rapidly from left to right. He...
.   ...
+===========================================

+===========================================
| Action Taken
|   We killed him, went through his
|   pickets, then started digging the...
. 
+===========================================





+===========================================
| 
|    Signature: _______________________
|                    Bruce Wayne
|        Title: The Batman
|  Employee ID: 1337-6669
+===========================================

我可以制作一些模仿我制作的示例的表格:

CREATE TABLE STRs (
   StrID int,
   Number text,
   Date datetime,
   Comments text,
   DescriptionOfSuspiciousActivity text,
   ActionTaken text,
   EmployeeName text,
   EmployeeTitle text,
   EmployeeNumber text )     

CREATE TABLE STRTransactions (
   STRTranasctionID int,
   STRID int,
   BuyAmount money)

CREATE TABLE STRTransactionSells (
   STRTransactionID int,
   SellAmount money)

CREATE TABLE STRTransactionPatronInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE STRTransactionThirdPartyInfo (
   STRTransactionID int,
   Name text,
   Address text,
   DOB text,
   IDNumber text,
   Occupation text )

CREATE TABLE OriginalTransactions (
   STRTransactionID int,
   BuyAmount money,
   SellAmount money )

我失败的实验

我尝试使用以下乐队布局创建 QuackReport:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

注意:缩进用于帮助识别父子关系(即带实际上不是缩进 50 像素)

这种设计的问题在于,至少在设计时,摘要带出现在两个搁浅的子带之前:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

+=====================================================+
| ChildBand3 (TQRChildBand, Parent=(none)             |
!      (autostretch)                                  !
+=====================================================+
    | ChildBand4 (TQRChildBand, Parent=ChildBand3     |
    !      (autostretch)                              !
    +=================================================+

当报告运行时(在运行时),两个搁浅的子带甚至不打印:

+=====================================================+
| PageHeader (TQRBand, BandType=rbPageHeader)         |
+=====================================================+

+=====================================================+
| DetailBand (TQRBand, BandType=rbDetail)             |
+===+=================================================+
    | ChildBand1 (TQRChildBnad, Parent=DetailBand)    |
    !      (autostretch)                              !
    +===+=============================================+
        | ChildBand2 (TQRChildBand, Parent=ChildBand1 |
        +=============================================+

+=====================================================+
| SummaryBand (TQRBand, BandType=rbSummary)           |
+=====================================================+

验证码:quackreports

4

1 回答 1

2

(请记住,我不再有 QuickReports 可用,所以这一切都来自记忆)

好的......我以前遇到过这个问题......给你一个完整的编码示例需要很长时间(我根本没有时间)但我会尝试描述我的解决方案,以便你可以联系给它。

不要使用 TQRChildBand,而是使用所有 DetailBand。然后,您挂钩每个乐队的 BeforePrint 事件。

您将在 BeforePrint 事件中使用类似的内容:

printband := FPrintSubBandA;

使用一组普遍可用的变量(或报告表单上的私有成员)来定义应该显示哪些波段,而不应该显示在报告中的给定记录......所有类型为布尔值注意:您可以使用一组枚举,但布尔值更容易/更快地实现 imho )

在您的 NeedData 事件中,您将推断给定记录需要哪些波段,并相应地设置这些变量(当然是布尔值)。

整个解决方案是一个肮脏的黑客,但必不可少,因为 QuickReports 对选择性记录上的嵌套子带的支持基本上不存在。

如果这还不够信息,请告诉我,我将翻阅我的代码档案,看看是否能找到我这样做的一个示例。本质上,这个确切的问题是我改用 RaveReports 的原因。

编辑:我想你很可能已经尝试在运行时设置每个子乐队的 ParentBand 值......如果你没有,不要浪费你的时间!这样做会导致更多异常结果(我什至尝试过访问冲突

于 2011-05-15T17:20:52.333 回答