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

Mgmt Image in Report Trouble

edited August 2007 in General
Dear All,

I have a report with landscape and portrait picture.

I need do check the type of picture to defined the the position of the
picture.

I do this check on the ppDBText.print. the problem I have the first picture
and the last picture of my sheet is the same and my check is not valid.

Anyone can help me ?

Tx for your reply.

JV.

Comments

  • edited August 2007
    Hi Jerome,

    I'm a bit unclear about how you are checking the individual images. Are you
    loading images from a database? Why are you checking an image in the
    DBText.OnPrint event? How are you determining whether the image is
    landscape or protrait?

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    Hi,

    The Image is loading from a database. The file format is a JPG file.

    In the DBText.OnPrint, I get the ID of the picture and by a select i'm going
    to load the picture in a TJPEGImage.

    After I check the width and the height of the pictue to defined if it's a
    landscape or Portrait format.

    You will find bellow the code on the dbText:onPrint :

    MyJpeg := TJPEGImage.Create;
    try
    with dtaPicture do
    begin
    Close;
    CommandText := 'Select Picture from Watch where ID = :ID and Brand_ID
    =:Brand_ID and Picture is not null';
    params.ParamByName('ID').Value := PictrueID.Text;
    params.ParamByName('Brand_ID').Value := dmMain.objUserCCB.Brand.ID;
    open;

    if not Eof then
    begin
    myJpeg.Assign(TBlobField(Fields[0]));

    if myJpeg.Width >= MyJpeg.Height then
    begin
    img.Visible := True;
    img.Picture.Assign(myJpeg);
    ppImgPortrait.Visible := False;
    end
    else
    begin
    ppImgPortrait.Visible := True;
    ppImgPortrait.Picture.Assign(myJpeg);
    img.Visible := False;
    end;
    end;
    Close;
    end;
    finally
    MyJpeg.Free;
    end;

    Thank you for your support.

    J?r?me
  • edited August 2007
    Hi Jerome,

    Thanks for the code, however I still do not see where the problem is
    occuring. Are you altering the SQL of the dataset connected to the report?
    You might try moving this code to the DetailBand.BeforePrint event. You
    will still have access to the same ID record.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited August 2007
    Hello,

    Thank you very much, your solution is working correctly !!

    Best Regards.

    JV

This discussion has been closed.