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

Printing Mutiple Images on the same page from a single table

edited May 2002 in General
I am using RB Enterprise version 6.03 on Delphi Professional Version 6.240
(Update Pack 2) on Windows XP Professional.

I have a Master table (Employees) and a Detail table (EmpPhotos). I have a
report which prints a single page for each employee name. In addition to
the employee information the same page needs to print up to three photos
(BMP or JPG).

My question is how can I print the first three photos on the same page?

The way I am doing it know is using thee TRxMemoyData Memory Table (PHOTO1,
PHOTO2, PHOTO3) and then attached each one to its own TppDBImage (ppImage1,
ppImage2, ppImage3) within the report. I placed the three DBImage
components within a single TppRegion on the single page.

Then before I print the report I use the following procedure to load the
memory tables with a photo:

procedure Form1.LoadPhotos;
var
i: Integer;
PictStream: TMemoryStream;
begin
PictStream := TMemoryStream.Create;

PHOTO1.EmptyTable;
PHOTO2.EmptyTable;
PHOTO3.EmptyTable;

EmpPhoto.First;
while not EmpPhoto.Eof do
begin
PictStream.Clear;
EmpPhotoPHOTO.SaveToStream(PictStream);
case i of
1: if Not EmpPhotoIMAGE.IsNull then
begin
PHOTO1.Insert;
PHOTO1IMAGE.LoadFromStream(PictSteam);
PHOTO1.Post;
end;
2: if Not EmpPhotoIMAGE.IsNull then
begin
PHOTO2.Insert;
PHOTO2IMAGE.LoadFromStream(PictSteam);
PHOTO2.Post;
end;
3: if Not EmpPhotoIMAGE.IsNull then
begin
PHOTO3.Insert;
PHOTO3IMAGE.LoadFromStream(PictSteam);
PHOTO3.Post;
end;
end;
EmpPhoto.Next;
end;
PictStream.Free;
end;

I would like to know if there is an easier way to read the photo records
directly from the original table without creating the memory tables.

Thank you,
John A

Comments

  • edited May 2002
    Create a group on the Employee name and have it is start a new page per
    group. Create two individual pipelines, one for the master table and one for
    the detail, set the detail pipeline's MasterPipeline property to the master
    pipeline and link them on employee name by setting the MasterFieldLinks
    property. Place a subreport component in the employee group and assign it
    the detail pipeline. Finally place a single DBImage component in the
    subreport detail band and assign it the picture field from the detail
    pipeline. The behvaior should be such that the master pipeline traverses all
    the employee names and for each prints all the pictures from the detail
    table which are associated with that name.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.