Creating new report dynamically
I am using TExtraDevices to save a report as html. I want to create a
(non existing) report dynamically and populate a richtext memo.
Report1 : TppReport;
DetailBand1: TppDetailBand;
RichText1: TppRichText;
// try creating on fly start
Report1 := TppReport.Create(Form2);
DetailBand1 := TppDetailBand.Create(Report1);
RichText1 := TppRichText.Create(DetailBand1);
RichText1.RichText := RichString;
// using TExtraDevices to save to file as html
// this blows up
TxUtils.ExportToFile(Report1,edfHTML,FileName);
The last line works if a basic report is created with a richtext memo on
a Detailband.
How can I get this working dynamically?
Thanks, Tom.
(non existing) report dynamically and populate a richtext memo.
Report1 : TppReport;
DetailBand1: TppDetailBand;
RichText1: TppRichText;
// try creating on fly start
Report1 := TppReport.Create(Form2);
DetailBand1 := TppDetailBand.Create(Report1);
RichText1 := TppRichText.Create(DetailBand1);
RichText1.RichText := RichString;
// using TExtraDevices to save to file as html
// this blows up
TxUtils.ExportToFile(Report1,edfHTML,FileName);
The last line works if a basic report is created with a richtext memo on
a Detailband.
How can I get this working dynamically?
Thanks, Tom.
This discussion has been closed.
Comments
You need to assign the TppDetailBand.Report and TppRichText.Band property
for the component to show up inside the report. Something like the
following...
var
lReport: TppReport;
lDetailBand: TppDetailBand;
lRichText: TppRichText;
begin
lReport := TppReport.Create(Self);
lDetailBand := TppDetailBand.Create(Self);
lRichText := TppRichText.Create(Self);
lDetailBand.Report := lReport;
lRichText.Band := lDetailBand;
lRichText.RichText := 'RichText!';
lReport.Print;
--
Regards,
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Nico Cizik
Digital Metaphors
http://www.digital-metaphors.com
Perfect, works great. I thought creating with an owner would do for
lDetailBand & lRichText as in my code example rather than having to
assign directly.
Cheers, Tom.