function LoadImageFromFile(const FileName: string; w: Integer = 0; h: Integer = 0): Boolean;

<< Click to Display Table of Contents >>

Navigation:  Programming > Mail Merge (replace fields with data) and data forms > Update Field (Insert Text from Database) > Event OnMailMergeGetText > TWPMMInsertTextContents >

function LoadImageFromFile(const FileName: string; w: Integer = 0; h: Integer = 0): Boolean;

Load an image into this field. This methods have been added to WPTools 8.

 

If You specify the width and height (twips values) the image will be scaled, keeping the original aspect ratio.

 

You can pass negative values for w and h to preserve the width and height of the image currently embedded in the field.

 

If currently no image is in the field, w and h will be used as absolute values.

 

  if inspname='IMAGE_A' then

  begin

   Contents.LoadImageFromFile('c:\a.jpg', -1440, -1440);

  end;

 

 

Also available is

function LoadImageFromStream(const ImageData: TStream; FileExt: string; w: Integer = 0; h: Integer = 0): Boolean;

 

It expects the data in a stream object and the file extension which defines the contents of the stream. For example ".JPG" if it is JPEG data.