Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Iterating thru recs and printing Jpegs

edited January 2002 in General
(I am evaluating RB before purchase)...
I have used QReports in the past and want to know specifically how I would
go about printing RTF Text + Jpegs from several records in a query result
set. The result set returns the RTF text blob and a path to the Jpeg.
Let's say I want to print the text on the left side of the page ( 5" wide)
and the corresponding Jpeg on the right adjacent side (3" wide).

1) I have defined Header-Footer and a TppDBRichText and TppImage (testing
just printing of image not linked to db yet - see Q2 below) component within
the tppReport component. Then I execute the following OnClick. It previews
each full page then moves onto the next page. I am obviously missing
something - not sure what.

2) Since each rec in the result set returns a path to the Jpeg, I need to
know which event I can use to load the Image into the TppImage control - is
this the way to do it?

3) Something else I will need to be able to do is, for multi-page tiffs,
the result set returns a specific page of the tiff that I need to display.

Thanks for helping me evaluate what looks like a v. powerful tool to see if
it meets my needs.

---

procedure TfrmFormsEmulation.btnPreviewClick(Sender: TObject);
begin
with ADOQuery1 do
while not eof do
begin
ppReport1.Print;
next;
end;
end;

Comments

  • edited January 2002
    The line of execution will stop at Report.Print, until the call has
    finished. I think you will only want to call Report.Print once. Connect the
    Report.Datapipeline to a datasource connected to the ADOQuery1. Now the
    report will traverse through the records in the query for you, and generates
    a single detail band for each record.

    Use the DetailBand.BeforeGenerate event to load the picture into the image
    component.

    ReportBuilder can't print multipage images. You'll have to extract the
    single page of you image and assign it to the RB image component so that it
    fits on a single report page.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited January 2002
    Not sure how to load the image at runtime.
    I have tried the following and get a runtime error:

    TPicture(ppImage1).LoadFromFile('MyImage.jpg');



  • edited January 2002
    The Image component has a Picture property to load from file.

    TppImage.Picture.LoadFromFile();

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.