Paste aus Zwischenablage...einfügen mit einem speziellen Font (Arial)

  • Hallo...

    da wir in unserer Software, speziell im Ausdruck, nur eine Schritart verwenden, sollen auch die Copy/Paste Texte im RTF mit Arial eingefügt werden. Ist das möglich? Welche Events kommen da in Frage?

    Danke...

    • Offizieller Beitrag

    Am meisten Kontrolle hat man über das Ereignis BeforePasteText:

    ( Sender: TObject; RTFData: TWPRTFDataCollection; par: TParagraph; Stream: TStream;

    Reader: TWPCustomTextReader; OnlyBodyText: Boolean; var LoadedText: TWPRTFDataBlock);

    Man kann hier die Attribute nach Notwendigkeit durch direkten Zugriff auf par anpassen.

    LoadedText könnte man auch auf einen ganz anderen TWPRTFDataBlock richten welcher dann stattdessen eingefügt wird. (nil ist bisher nicht möglich)

    In diesem Fall wird es aber vermutlich bereits reichen, das entsprechende Flag in der property ClipBoardOptions zu setzen:

    TWPClipboardOptions = set of

    ( wpcoNoInternalDragAndDrop, // Switch off the internal drag&drop

    wpcoNoDragAndDropFromOutside, // Allow only Drop from within

    wpcoAlwaysDeleteInDragSource, // Delete dragged source text if from different editor, too!

    wpcoDontMoveCursorDuringDrag, // Do not show cursor when dragging

    wpcoNoAutoSelSpaceExtension, // Don't select preceding or trailing spaces when doing Drag&Drop

    wpDontHideCaret, // do not hide the caret while selection is active

    wpcoDontPasteWPT, wpcoDontPasteRTF, wpcoDontPasteANSI, wpcoDontPasteUNICODE, wpcoDontPasteHTML,

    wpcoPasteHTMLWhenAvailable, // Paste HTML even if RTF is available (unless wpcoDontPasteHTML was set)

    wpcoDontPasteGraphics,

    wpcoDontCopyRTF, wpcoDontCopyANSI, wpcoDontCopyUNICODE, wpcoDontCopyWPTOOLS, wpcoPreserveBorders, wpcoPreserveShading,

    wpcoPreserveIndents,

    wpcoDontAutoAppendSpace,

    wpcoPasteAsNestedTable, // - cells are always pasted as nested table

        wpcoDontPasteFonts, wpcoDontPasteFontSizes,

    wpcoDoNotUseInsertMode, // Any paste operation will completely replace the document!

    wpcoDontCopyProtectedText, // Do not copy protected text - independently to ppProtectSelectedTextToo

    wpcoDontCopyProtectedAttribute, // Do not save the afsProtected Attribute

    wpcoAlwaysCopyImagesEmbedded, // Copy BLOB data for linked images

    wpcoAlsoCopyHTML, // also copy HTML to clipboard

    wpcoAlsoPasteRTFVariables, // Per default don't load RTF variables from clipboard

    wpcoDontPasteWhenTextIsSelected,

    wpcoPastedANSIDoesNotInheritParAttr // By default, when pasting ANSI text the new paragraphs inherit the current paragraph attributes

    );