程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> 用Delphi的QReport部件生成報表(2)

用Delphi的QReport部件生成報表(2)

編輯:Delphi

報表窗體repForm中的部件及屬性設置如下:

部件 屬性及屬性值

Query1: TQuery DatabaseName:d:\sb
Active: True
Qrep1: TQuickrep Dataset:query1
TitleBand1: TQRBand BandType:rbTitle
HeadBand1: TQRBand BandType:rbColumnHeader
DrawLeft : True
DrawRight : True
DrawTop : True
DrawBottom : True
DetailBand1: TQRBand BandType:rbDetail
DrawLeft : True
DrawRight : True
DrawTop : True
DrawBottom : True
ChildBand1: TQRChildBand ParentBand:DetailBand1
DrawLeft : True
DrawRight : True
DrawTop : True
DrawBottom : True
TitleLabel: TQRLabel Caption:設備統計表
DlmcLabel: TQRLabel Caption:類別
SbxhLabel: TQRLabel Caption:型號
SbpzLabel: TQRLabel Caption:配置
SbslLabel: TQRLabel Caption:數量
DlmcDBText: TQRDBText Dataset:Query1
DatafIEld: dlmc
SbxhDBText: TQRDBText Dataset:Query1
DatafIEld: sbxh
SbpzDBText: TQRDBText Dataset:Query1
DatafIEld: sbpz
SbslDBText: TQRDBtext Dataset:Query1
DatafIEld: sbsl
Shape1~9: TQRShape Shape:qrsVertline
Top:0
Width:1
Query1的SQL屬性設置為:
select a.dlbh,a.dlmc,b.sbxh,b.sbpz,b.sbsl
from dlbmk a,sbxhk b
where a.dlbh=b.dlbh and b.xhbm not in
(select xhbm from bmsbk where trim(bmmc)$#@60;$#@62;’電腦部’)
order by a.dlbh

設置幾個TQRband部件的DrawLeft、DrawRight、DrawTop、DrawBottom屬性值為True,是為了打印表格邊框及橫線。利用TQRShape部件,是為了打印出表格豎線。DlmcDBText放置在DetailBand1上,其它幾個TQRDBText部件放置在ChildBand1上,Shape1~3放置在HeadBand1上,Shape4~6放置在DetailBand1上,Shape7~9放置在ChildBand1上。

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved