Class TWPOImage

Hierarchy

System.TObject | System.Classes.TPersistent | System.Classes.TComponent | WPRTEDefs.TWPObject | WPOBJ_Image.TWPOCustomImage | TWPOImage

Description

An instance of this class is usually linked to the WPTextObj.ObjRef property to embed an image. Examples ... This class, it is implemented in unit WPOBJImage is used to handle all supported types of bitmaps and metafiles. Using the (currently freeware) library GRAPHICEX it can, among other formats, also handle PNG files. Example Insert a bitmap which is stored in a TImage object: WPRichText1.TextObjects.InsertCopy(Image1.Picture.Graphic); Example Insert a bitmap which was loaded form file: var obj : TWPOImage; begin obj := TWPOImage.Create(WPRichText1.Memo.RTFData); obj.LoadFromFile('c:\BarChart.emf'); WPRichText1.TextObjects.Insert(obj); end; Example Insert a bitmap which was stored in a database field: var aField: TField; // value assigned somewhere cell: TParagraph; // a new cell or paragraph wpobj: TWPObject; obj: TWPTextObj; begin ... if aField is TGraphicField then begin bit := TBitmap.Create; bit.Assign(aField); // Create a TWPOImage with a certain bitmap wpobj := TWPOImage.CreateImage(WPRichText1.Memo.RTFData, bit); // and a new TWPTextObj obj := TWPTextObj.Create; // 'cell' has been created before cell.Insert(0, obj); // Assign the reference obj.ObjRef := wpobj; // the width and height obj.Width := wpobj.ContentsWidth; obj.Height := wpobj.ContentsHeight; end ... end;

Methods

Used or referenced by

-Property TWPMMInsertTextContents.CurrentObject : TWPObject