Page 1 of 1

How can I get plain text when I paste from MS Word?

Posted: Tue Jan 05, 2010 8:16 am
by cakk
When I copy from MS Word, and paste to RichviewEdit, I just want the plain text, don't need the font style. How can I do it?

Thanks!

Posted: Tue Jan 05, 2010 8:55 am
by Sergey Tkachenko
Call PasteText.
If you use RichViewAction, use a new action: TrvActionPasteAsText (in the ActionTest demo, this is "Edit | Paste as Text" command).

Posted: Tue Jan 05, 2010 8:02 pm
by emo
Look also here
http://www.trichview.com/forums/viewtop ... nicodetext

I use this code for pasting only text

in OnPaste event handler of TRichViewEdit

var s: wideString; Data: THandle;

Clipboard.Open;
Data := GetClipboardData(CF_UNICODETEXT);
try
if Data <> 0 then
s := PWideChar(GlobalLock(Data))
else
s := '';
finally
if Data <> 0 then GlobalUnlock(Data);
Clipboard.Close;
end;
Sender.InsertTextW(s, False);
DoDefault := False;

Posted: Sat Jan 16, 2010 5:02 pm
by cakk
Thanks. It's Works good!