Inserting graphic programmatically

  • I would like to create a document programmatically and insert bitmaps in it.

    The bitmap should be on its own paragraphs.

    I am currently using a procedure that looks like this to append text to the end of the document:

    procedure TReportDlg.AppendText(S: string);
    var
    prp: TParProps;
    begin
    FillChar(prp, Sizeof(TParProps), 0);
    prp.Attr := TWpRichText.Attr;
    prp.Text := S;

    {some additional formatting codes}

    TWpRichText.FastInputText(prp);
    end;


    Is there a way to create a similar procedure that would insert a bitmap rather than text?

    • Offizieller Beitrag

    Hi,

    to insert an image at cursor position (use CPPosition := MaxInt to go to te end) use


    obj : TWPObject;

    obj := WPLoadObjectFromFile(Self, FileName, false);
    obj.WriteRTFMode := wobBoth;
    WPRichText.TextObjects.Insert(obj);

    Julian