Dynamic Report
Hi,
I want to create a report at runtime:
First Follow the tech-tip to create the report .
In order to keep all the control together in the detailband, I dynamic
create a region
with the following code:
FRegion_Detail := TppRegion.Create(Self);
FRegion_Detail.spHeight := 40;
FRegion_Detail.Stretch := True;
FRegion_Detail.KeepTogether := True;
and with following Code to add Object( include TppDBText and TppDBMemo) into
it:
tmp_Text := TppDbText.Create(Self);
Region_Detail.AddObject(tmp_Text);
With tmp_Text Do
Begin
Band:=ReportObject.DetailBand;
AutoSize:=False;
Alignment:=FDataSource.DataSet.FieldByName(sFieldName).Alignment;
spTop:=FRegion_Detail.spTop;
spLeft:=x+2;
spWidth:=nTmpWidth-5;
DataPipeLine:=DbPipe;
DataField:=MyFieldName;
End;
However, one of the rows is printed on seperate two page. If I don't create
it at runtime, Just create it thorught the Report designer. It works.
Please indicate what is the problem with above code.
I want to create a report at runtime:
First Follow the tech-tip to create the report .
In order to keep all the control together in the detailband, I dynamic
create a region
with the following code:
FRegion_Detail := TppRegion.Create(Self);
FRegion_Detail.spHeight := 40;
FRegion_Detail.Stretch := True;
FRegion_Detail.KeepTogether := True;
and with following Code to add Object( include TppDBText and TppDBMemo) into
it:
tmp_Text := TppDbText.Create(Self);
Region_Detail.AddObject(tmp_Text);
With tmp_Text Do
Begin
Band:=ReportObject.DetailBand;
AutoSize:=False;
Alignment:=FDataSource.DataSet.FieldByName(sFieldName).Alignment;
spTop:=FRegion_Detail.spTop;
spLeft:=x+2;
spWidth:=nTmpWidth-5;
DataPipeLine:=DbPipe;
DataField:=MyFieldName;
End;
However, one of the rows is printed on seperate two page. If I don't create
it at runtime, Just create it thorught the Report designer. It works.
Please indicate what is the problem with above code.
This discussion has been closed.
Comments
to a region. Calling Region.AddObject isn't enough. When you set the
region property, Region.AddObject is called automatically so you don't have
to call it.
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com