Page 1 of 1
Copy MS Word content to TRichviewEdit
Posted: Tue Apr 17, 2012 12:42 am
by King Cheung
I'm trying to copy content from MS Word and paste it to TRichviewEdit. In the OnPaste event, my code like this:
Code: Select all
str := Clipboard.AsText;
rchvwdt.InsertTextA(str,False);
DoDefault := false;
In this way, what i get is plain text without font info. What should i do to get text with font info?
Posted: Tue Apr 17, 2012 3:22 am
by King Cheung
Cause the pasted content mostly chinese,if i dont't add the OnPaste function, their will be some error.For example, if i copy "(有无)"from Ms Word, after i paste it to richviewedit, it will be "(无".
Posted: Tue Apr 17, 2012 10:52 am
by Sergey Tkachenko
Why do you need to process OnPaste? TRichViewEdit can paste the content saved by MS Word automatically, without any additional code.
Posted: Tue Apr 17, 2012 12:04 pm
by King Cheung
Sergey Tkachenko wrote:Why do you need to process OnPaste? TRichViewEdit can paste the content saved by MS Word automatically, without any additional code.
When i copy chinese from Ms Word to TRichViewEdit,sometimes it will be wrong.You can try it, when copy "(有无)" from MS Word to TRichViewEdit, the result will be "(无".
Posted: Tue Apr 17, 2012 4:01 pm
by Sergey Tkachenko
What version of Delphi do you use?
Please give me step by step instructions how to reproduce this problem.
Send the source doc file to richviewgmailcom
Posted: Wed Apr 18, 2012 1:38 am
by King Cheung
Sergey Tkachenko wrote:What version of Delphi do you use?
Please give me step by step instructions how to reproduce this problem.
Send the source doc file to richviewgmailcom
I am using Delphi 7, and the richview version is v11.0.5.FS.AS we need to paste chinese to TRichViewEdit,so unicode is the only choice.Then i add some code like this:
Code: Select all
rchvwdt.Clear;
for i:= 0 to rvstyl.TextStyles.Count-1 do
rvstyl.TextStyles[i].Unicode := True;
rchvwdt.RTFReadProperties.UnicodeMode := rvruOnlyUnicode;
I will send you a chinese test doc, you can copy the text and paste it to TRichViewEdit,then it will cause the error.
Posted: Thu Apr 19, 2012 6:01 am
by King Cheung
Sergey Tkachenko wrote:What version of Delphi do you use?
Please give me step by step instructions how to reproduce this problem.
Send the source doc file to richviewgmailcom
Hello Sergey,
Do you test the chinese text? I really look forward to your solution!Thank you!
Posted: Thu Apr 19, 2012 12:21 pm
by Sergey Tkachenko
I tested you file - copied it from MS Word to TRichViewEdit, and it looks exactly the same.
You use an old version of TRichView, please update it and test if this problem still exists.
Posted: Fri Apr 20, 2012 2:26 am
by King Cheung
Sergey Tkachenko wrote:I tested you file - copied it from MS Word to TRichViewEdit, and it looks exactly the same.
You use an old version of TRichView, please update it and test if this problem still exists.
Hello Sergey,
The problem is solved after i update the TRichView. Thank you!