Hi to all,
i have a Template rtf document with some "Merge-fields". For one of this i need to substitute the field with a Bitmap image readed from a BMP file.
I write this code:
1) On my class constructor (C++Builder) i read the bitmap and stored it on a TBitmap object:
FBitmapLogo = new Graphics::TBitmap();
String logoFile = ExtractFilePath(Application->ExeName) + "Logo.bmp";
if ( FileExists(logoFile) )
FBitmapLogo->LoadFromFile(logoFile);
2) On event OnGetText i assign the bitmap to a new TWPOImage object and set Contents->Obj:
void __fastcall TMailMergeEngine::SuperMergeGetText(TObject *Sender,
const AnsiString fName, TWPInsertTextContents *Contents)
{
if ( fName == "LogoGrafico" )
{
TWPOImage * obj = new TWPOImage(WPMerge);
obj->Picture->Bitmap->Assign(FBitmapLogo);
obj->HeightTW = MulDiv(obj->Picture->Bitmap->Height,1440,Screen->PixelsPerInch);
obj->WidthTW = MulDiv(obj->Picture->Bitmap->Width,1440,Screen->PixelsPerInch);
obj->WriteRTFMode = wobOnlyRTF;
Contents->Obj = obj;
}
}
But non Bitmap are displayed on my report.
I missing something ?