How to Insert an Image Into a Header from a Stream

  • I am currently using the following code but the Image is being inserted into the body. Any help greatly appreciated:

    ..
    WPRichText1.ActiveText:=WPRichText1.HeaderFooter.Get(wpIsHeader,wpraOnFirstPage,'');
    Img:=TWPOImage.Create(WPRichText1);
    Img.FileExtension:= 'jpg';
    Img.LoadFromStream(BlobStream);
    Img.WidthTW:=Img.ContentsWidth;
    Img.HeightTW:=Img.ContentsHeight;
    with WPRichText1.TextObjects.Insert(Img) do
    begin
    PositionMode:=wpotPar;
    Wrap:=wpwrLeft;
    RelX:=WPRichText1.Header.PageWidth-Img.WidthTW;
    end;
    WPRichText1.ActiveText:=WPRichText1.BodyText;
    ...

    • Offizieller Beitrag

    Hi,

    the image is really in the header, it is only moved down and displayed under the page. This feature is usually used to create a watermark.

    If you like the header to be enlarged you need to use PositionMode:=wpotChar instead of PositionMode:=wpotPar;

    Julian

  • Ken,

    Pardon my jump into this thread, but... [JUMP]

    I might not understand your particular needs, but have you tried using WPRichText1.TextObjects.Insert(Img).rely, and setting it negative?

    Fingers crossed for you,
    richard diamond