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

General TRichView support forum. Please post your questions here
Post Reply
cakk
Posts: 14
Joined: Thu Dec 17, 2009 2:35 am

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

Post 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!
Sergey Tkachenko
Site Admin
Posts: 17602
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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).
emo
Posts: 8
Joined: Wed Nov 21, 2007 7:40 pm

Post 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;
cakk
Posts: 14
Joined: Thu Dec 17, 2009 2:35 am

Post by cakk »

Thanks. It's Works good!
Post Reply