用下列程序可以生成字段的字段名(用aLabel变量),用aText却只能生成第一条记录!能不能告诉我更好的解决办法,但是除了Infopower、1stClass不要用其他第三方控件,请大伙帮忙了,谢谢!
------------------------------------------------
procedure TFormDataView.BitBtn3Click(Sender: TObject);
var
aLabel: TQRLabel;
aText:TQRDBText;
FieldCount,i,LeftValue:integer;
begin
FieldCount:=ADOQueryPianQu.SQL.Count; LeftValue:=0;
for i:=0 to FieldCount-1 do //循环FieldCount次,生成所有列
begin
aLabel:=TQRLabel.Create(FormPrintZD); //FormPrintZD 是一个放置QuickRep的Form
with FormPrintZD do
aLabel.Parent:= HeaderBand1; //放在HeaderBand(rbDetail)里
with aLabel do //设置属性
begin
AutoSize:=True; //好像这个值必须为True
AutoStretch:=True;
Alignment:=taLeftJustify;
Left:=LeftValue;
Top:=8;
Height:=14;
LeftValue:=Width+LeftValue+10;
end;
end; LeftValue:=0;
for i:=0 to FieldCount-1 do
begin
aText:=TQRDBText.Create(FormPrintZD);
with FormPrintZD do
aText.Parent:= QRSubDetail1;
with aText do
begin
Dataset:=ADOQueryDataView;
DataField:=ADOQueryDataView.Fields[i].FieldName;
AutoSize:=True;
AutoStretch:=True;
Alignment:=taLeftJustify;
Left:=LeftValue;
Top:=8;
Height:=14;
LeftValue:=Width+LeftValue+10;
end;
end; FormPrintZD.QuickRep1.Preview;
end;
------------------------------------------------
procedure TFormDataView.BitBtn3Click(Sender: TObject);
var
aLabel: TQRLabel;
aText:TQRDBText;
FieldCount,i,LeftValue:integer;
begin
FieldCount:=ADOQueryPianQu.SQL.Count; LeftValue:=0;
for i:=0 to FieldCount-1 do //循环FieldCount次,生成所有列
begin
aLabel:=TQRLabel.Create(FormPrintZD); //FormPrintZD 是一个放置QuickRep的Form
with FormPrintZD do
aLabel.Parent:= HeaderBand1; //放在HeaderBand(rbDetail)里
with aLabel do //设置属性
begin
AutoSize:=True; //好像这个值必须为True
AutoStretch:=True;
Alignment:=taLeftJustify;
Left:=LeftValue;
Top:=8;
Height:=14;
LeftValue:=Width+LeftValue+10;
end;
end; LeftValue:=0;
for i:=0 to FieldCount-1 do
begin
aText:=TQRDBText.Create(FormPrintZD);
with FormPrintZD do
aText.Parent:= QRSubDetail1;
with aText do
begin
Dataset:=ADOQueryDataView;
DataField:=ADOQueryDataView.Fields[i].FieldName;
AutoSize:=True;
AutoStretch:=True;
Alignment:=taLeftJustify;
Left:=LeftValue;
Top:=8;
Height:=14;
LeftValue:=Width+LeftValue+10;
end;
end; FormPrintZD.QuickRep1.Preview;
end;
解决方案 »
- 跪求 Delphi(fastreport)高手解决主数据取数问题
- 请问如何才能将这些ASCII码写到数据库,并且能以后读出来呢?
- 数据库连接池的问题,请大家帮忙,
- Waiting!几个问题大家帮忙看看怎么解决!急呀。。。。分数好说!
- 关于制作业务类控件
- 多表查询的问题:在线等待。
- 如何在PopupMenu和Listbox中加入复选框checkbox,请说详细步骤,谢谢!
- 数据库--新手
- 大家好,请问大家,从数据库中将一个表的某个字段的全部记录读入到一个Tlist中
- 请问如何使Delphi做的程序不显示在任务栏中?
- 如何设置StringGrid或DrawGrid列向网格线为不同的颜色?(24小时等候)
- 求助:怎么安装DELPHI文件
Caption:=ADOQueryDataView.Fields[i].FieldName;things(平): 我试过,不行! ft...
aText的dataset其实可以不设置,只要band设置了就可以
Top:=8;
改为 top:=top+i*10;
你的top应该一直改变
Top := 8
注意事项都考虑到了,那就是你语句设值的错误了。
http://www.ahetc.gov.cn/cit/200012/15.doc谢谢了,开始派分... :)
----------------------------
I Love :GNU/Linux、Delphi、Cisco...
QQ:9795755 [email protected]