• Hello,
    I'm writing a routine auto-text. I created a table for the User type text.
    in another form when he enters a shortcut, eg "1" and enter key, do I find the text with the code and add 1 at the current cursor position using the function: InputString. The problem is that the text appears without the original formatting, totally mangled. Julian, can you help me?

    My code

    OnKeyPress Event

    • Offizieller Beitrag

    Hi,

    InputString would not understand RTF codes.

    You can insert RTF text at cursor position using SelectionAsString.

    Example:
    WPRichText.SelectionAsString := SourceWPRichText.AsString;

    Do not use "Text", You will loose the RTF format.

    CPWord may not be useful here. It is used in the AfterCompleteWord event which is the usual event to add makros and auto text support.

    Julian