frxPicture-Component doesnt operate properly

Hello,

i want to report about a problem (bug) with TfrxPictureView.

I intend to bring a series of pictures into a report.

In FR-IDE:
frxMasterData.OnBeforePrint

It is of different effect
if I enter a Filename into a Picture1:TfrxPictureView

1.
by Picture1.Picture.LoadFromFile('D:\Pictures\Pict1.bmp')
and
2.
by Picture1.Picture.LoadFromFile(Memo1.Text)
respectivly.

remarked:
Memo1.TfrxMemoView I use to transfer fileName from Delphi into FastReport.

in 1.
Picture1.Picture.LoadFromFile('D:\Pictures\Pict1.bmp')
Picture1 will be shown.

in 2.
Picture1.Picture.LoadFromFile(Memo1.Text)
Picture1 will not be shown.

The content of Memo1.text is correct, I had tested it.
Anything must be wrong here?!


I am hesitated .

Many thanks for help

EB

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 7:40AM
    Picture1.Picture.LoadFromFile('fullpath&filename;)
    requires a string and needs string delimiters so build your string correctly

    Picture1.Picture.LoadFromFile('+(Memo1.Text)+');
    or
    Picture1.Picture.LoadFromFile('+(vartostr(Memo1.value))+');


  • edited March 2010
    Thanks,

    but both proposals doesnt operate

    in case 1
    Compiler gives:
    unknown PictureFileextention (.text)+)' occurred

    in case 2
    compiler gives:
    unknown PictureFileextention (.value))+)' occurred

    Than Compiler stops in unit fs_igraphicsrtti
    row 182
    TPicture(Instance).LoadFromFile(Caller.Params[0])

    I dont understand Yout proposal.
    What the +-signs means?

    Thanks

    EB.
  • Anu de DeusAnu de Deus Hampshire, UK
    edited 7:40AM
    I suspect a problem with the variant conversions.
    Try this instead:
    var lFileName : string;
    begin
      lFileName := Memo1.Text;
      showmessage(lFilename); // just to debug it
      Picture1.Picture.LoadFromFile(lFileName);
    end;
    
  • edited 7:40AM
    Hello Anu de Deuss,

    I'd tested Your code.
    In the showmessage not the content of memo occurred, the variablename of the Memo (element), transferring the Filename, will be shown.

    e.g. there any Problem with variable conversion exsist.

    Many thanks for ideas.

    EB
  • gordkgordk St.Catherines On. Canada.
    edited 7:40AM
    there does seem to be a bug when passing values to loadfromfile or to filelink property
    will get back to you.
    the reason you only see the expression that is in the memo view is that is what is there before it is handled so use the oadevent of the memo to get the value or use the datafield directly
    picture1.loadfromfile(<dataset."fieldname">);
    also remember that to retrieve a value from memo1's memo it must have been processed before the pictureview is processed.
    ie hardcoded

    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    var
    mylink:string;
    begin

    mylink:= 'C:\logo.jpg';
    showmessage(mylink);
    picture1.loadfromfile(mylink);
    end;
    will work
  • gordkgordk St.Catherines On. Canada.
    edited 7:40AM
    since memo1.text is all the text of the memos array of lines.
    you need to use the trim function to strip any leading or trailing spaces.
    picture1.picture.loadfromfile(trim(memo1.text));
    this will work if memo1 contains text like c:\logo.jpg
    and allow expresions is turned off
    however since your memo contains [datasetname."fieldname"] you may need to work in the oad event of memo1 and retrieve memo1.value and set the filelink prop of the pictureview.
    ill test this later after i create a table and field
  • gordkgordk St.Catherines On. Canada.
    edited 7:40AM
    procedure Picture1OnBeforePrint(Sender: TfrxComponent);
    begin

    picture1.loadfromfile(trim(memo1.text));
    end;
    works fine if the memo contains [datasetname."fieldname"]
  • edited April 2010
    Many thanks,

    but Your efforts are without of success, unfortunatly.

    Now I'm looking for another solution, printing a lot of *.bmp-Pictures into a NoDatabaseReport.

    Should it possible to load the *.bmp-Pictures in the Delphi Code, but not in the FastReport Code ?

    In DelphiTreff Forum I had found such an idea.
    Looking please into http://forum.delphi-treff.de/showthread.php?t=1501.

    Now my question:
    In the FR4 Trial I doesnt find the TfrView.
    Should it possible, that TfrView only exists in the puchased version of FR4, and not in the Trial Version ?

    Than I intend to test this way.

    Have You another, better ideas solving this problem properly ?

    Thankfull, my dream is to solve this problem before Eastern ++ my dream ..

    Many thanks and hopes

    EB
  • gordkgordk St.Catherines On. Canada.
    edited 7:40AM
    EccoBravo wrote: »
    Many thanks,

    but Your efforts are without of success, unfortunatly.

    Now I'm looking for another solution, printing a lot of *.bmp-Pictures into a NoDatabaseReport.

    Should it possible to load the *.bmp-Pictures in the Delphi Code, but not in the FastReport Code ?

    In DelphiTreff Forum I had found such an idea.
    Looking please into http://forum.delphi-treff.de/showthread.php?t=1501.

    Now my question:
    In the FR4 Trial I doesnt find the TfrView.
    Should it possible, that TfrView only exists in the puchased version of FR4, and not in the Trial Version ?

    Than I intend to test this way.

    Have You another, better ideas solving this problem properly ?

    Thankfull, my dream is to solve this problem before Eastern ++ my dream ..

    Many thanks and hopes

    EB

    1 the article you referenced is about fr2 not fr4
    2 using the trim function works fine here.
    remember report engine handles top down according to band type and l to r in the band in order of creation.
    so your memoview must come before your picture.

    yes you can do it from delphi in the tfrxreport component on before print event.
    if sender.name = 'Picture1' then
    begin
    tfrxpictureview(sender).picture.loadfromfile(path&filename);
    end;




  • edited 7:40AM
    Hello

    after several exersices I have found a possibility loading a series of *.bmp Pictures into a FR.
    My way is only by using the Delphi IDE, not code in the FR4.

    There the code is:

    procedure TForm1.FormCreate(Sender: TObject);
    begin
        sl := TStringList.Create;
    
        sl.Add('G:\Path\Test1.bmp');
        sl.Add('G:\Path\Test2.bmp');
        sl.Add('G:\Path\Test3.bmp');
        sl.Add('G:\Path\Test4.bmp');
        sl.Add('G:\Path\Test5.bmp');
        sl.Add('G:\Path\Test6.bmp');
        sl.Add('G:\Path\Test7.bmp');
        sl.Add('G:\Path\Test8.bmp');
        sl.Add('G:\Path\Test9.bmp');
    end;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
        FrxReport1.PrintOptions.Printer := 'Acrobat PDFWriter';
        FrxReport1.FileName := 'G:\Path\TargetDoc.pdf';
        StringDS.RangeEnd := reCount;
        StringDS.RangeEndCount := sl.Count;
        frxReport1.ShowReport;
    end;
    
    procedure TForm1.frxReport1BeforePrint(c: TfrxReportComponent);
    var
        Pict: TfrxPictureView;
        Name: string;
    begin
        if c is TfrxPictureView then
        begin
            Name := TfrxPictureView(c).Name;
            if Name = 'Picture1' then
            begin
                Pict := TfrxPictureView(c);
                Pict.Picture.LoadFromFile(sl[StringDS.RecNo]);
            end;
        end;
    end;
    

    Now this Code operates till one residuing problem:
    If in Runtime I open the PrintDialog in FrxReport1.Prewiew, the correct FileName will be shown, but the correct PathName will not be shown.
    Where I can give its the correct Path?

    Thanks

    EB

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.