Image

Hi guys, i wanna apply the text from text field in report to an image object path. Text field have name "path" and image object have name "image". I was type this code:
image.picture.loadfromfile(path.text);
but with no success, i got error message...
I'm using Delphi, any idea how to fix this? [img]style_emoticons/<#EMO_DIR#>/dry.gif" style="vertical-align:middle" emoid="<_<" border="0" alt="dry.gif" /> thanks in advance ....[/img]

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 12:49PM
    loadfromfile requires a string with string delimiters and if you are using datasets fields from the report
    you need datasetname."fieldname" enclosed in <>
    so this is not what you want
    image.picture.loadfromfile(path.text);

    image.picture.loadfromfile('+<datasetname."path"><datasetname."text">+');

  • edited 12:49PM
    gordk wrote: »
    loadfromfile requires a string with string delimiters and if you are using datasets fields from the report
    you need datasetname."fieldname" enclosed in <>
    so this is not what you want
    image.picture.loadfromfile(path.text);

    image.picture.loadfromfile('+<datasetname."path"><datasetname."text">+');

    i tried this too, but on this way picture fields on report loading only last path in database, i want to make some kind of report with all images in database :s
  • gordkgordk St.Catherines On. Canada.
    edited 12:49PM
    where are you writing the code?
    if you are only getting the last picture loaded there is something else wrong.
  • edited 12:49PM
    gordk wrote: »
    where are you writing the code?
    if you are only getting the last picture loaded there is something else wrong.

    Ok here is my project, i want to apply paths from "Slika" cells to images in report
  • gordkgordk St.Catherines On. Canada.
    edited 12:49PM
    with the project you posted
    1 your tfrx reportcomponent clear the dataset property, since you have the mdband connected to it.

    2 in your report write code in the opb event of the masterdataband

    procedure MasterData1OnBeforePrint(Sender: TfrxComponent);
    begin
    picture1.picture.clear;
    picture1.picture.loadfromfile(<frxDBDataset1."Slika">);
    end;

    note you will probably want to write a Custom fileexists function so that you can check if the file exixts before trying to load it or you will get an error if the file does not exist.

  • edited August 2013
    It's working now, thanks a lot >
  • edited 12:49PM
    Hi, here is my VB.NET project for loading image from file with a free image processing SDK I googled:
    Imports System.IO
    Imports System.Drawing.Printing
    Imports RasterEdge.Imaging
    Imports RasterEdge.Imaging.Processing
    
    Dim Image As New RasterEdgeImaging()
    
    Image.LoadImageFromFile(@"C:\1.png")
    

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.