Reputation: 99
i want paste in delphi from richedit to word application i used Following code but Twice paste data in word (duplicate)
WordApp := GetActiveOleObject('Word.Application');
WordApp.Visible := True;
Wordapp.documents.open('C:\Doc1.docx');
Richedit.Text := 'test text';
Richedit.SelectAll;
Richedit.CopyToClipboard;
WordApp.ActiveDocument.ActiveWindow.Selection.Paste;
WordApp.selection.paste;
Upvotes: 1
Views: 1720
Reputation: 15817
Are you trying to end up with this?
test text
test text
But only getting this?
test text
If so, then maybe the "selection" is causing it to paste the same data into the same selection, thus the 2nd paste wipes out the first one.
Upvotes: 0