Saving a Gif file into RTF header

  • In Wp 5 I'm attempting to save a header that contains a GIF as RTF
    The command I use is as follows

    Code
    Result := WP.HeaderFooter.Get(wpHeader, wpraOnAllPages).RtfText.AsANSIString('Rtf-AlwaysEmbed');

    However I get back the RTF with what appears as a tuncated version of the file

    Zitat

    Header RTF = '{\rtf1\ansi\deff0\uc1\ansicpg1252\deftab720{\fonttbl{\f0\fnil\fcharset1 Arial;}{\f1\fnil\fcharset1 AvantGarde Bk BT;}{\f2\fnil\fcharset1 Wingdings;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;}\wpprheadfoot1\paperw12240\paperh15840\margl1880\margr1880\margt1440\margb1440\headery100\footery100\ftnbj\sftnbj\sftnrstcont\nocolbal\sftnnar\saftnnar\fet0\endnhere\sectdefaultcl{\*\generator WPTools_5.370-PRM;}{\tblstart1{\trowd\trleft-1417\trftsWidth2\trwWidth5000\clftsWidth2\clwWidth2500\clvertalt\cellx4223\clftsWidth2\clwWidth5000\clvertalt\cellx9863\pard\intbl\itap1\li0\fi0\ri0\sb0\sa0\ql\plain\fs22{\*\wptools\wpomode0\wpoframe0{110e0a005457504f626a6563740054504630095457504f626a656374000757696474685457039b0a08486569676874545703ae060c57726974655254464d6f6465070c776f624175746f6d61746963064f626a546167020000003f3f3f00}}\cell\pard\intbl\itap1\li0\fi0\ri0\sb0\sa0\qr\plain\f1\fs28\b{\field{\*\fldinst{MERGEFIELD ZFD|SIMPLE^^L|sSTF|dtHL7ST|Practice_Address.OtherDesignation}}{\fldrslt{Practice Name}}}\cell\row}\tblend1\pard\plain\li-1417\ri-1417\par
    }}'

    An attempt to reopen the file gives me only the place holder . I've compiled the code with GIFIMG.
    If I do the same with a BMP file then every thing is hunky dory.

    Any suggestions
    Thanks in advance

  • Oh - and the image was inserted thus

  • OK got the saving issuse sorted

    and the save is RtfText.AsANSIString('Rtf-AlwaysEmbed,-nobinary,'); (note the commas).
    But the gif images are no longer transparent.
    Looks like another challage awaits

  • OK got the Transparency issue fixed however the solution is not the most elegent but at least I'll get to feed the kids this week.

    • Offizieller Beitrag

    Hi,

    Good that you found the solution.

    If you want transparent images You can use PNGs. They (and PNGLib) work a lot better than the GifImage.

    If you use the "AlwaysScreenRes" option in FormatOptions the displ,ay is faster.

    You solution to update the gif is interesting. I would have suggested to paint the GIF transparently on a bitmap and reassign.

    Julian

  • Zitat von wpsupport


    If you want transparent images You can use PNGs.


    User is allowed to select images and gifs ( and jpgs and png)are in the breif

    Zitat von wpsupport

    ..
    You solution to update the gif is interesting.


    Quick and dirty would be a better description. :)

    Zitat von wpsupport


    I would have suggested to paint the GIF transparently on a bitmap and reassign.
    Julian


    I'll give that a try.