【问题标题】:paste with delphi in ole automation在ole自动化中粘贴delphi
【发布时间】:2010-07-10 08:21:33
【问题描述】:

我想在 delphi 中从 Richedit 粘贴到 Word 应用程序 我使用了以下代码,但在 word 中两次粘贴数据(重复)

  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;

【问题讨论】:

    标签: delphi automation ms-word ole


    【解决方案1】:

    尝试省略代码的最后一行

    【讨论】:

      【解决方案2】:

      你想结束这个吗?

      test text
      test text
      

      但只得到这个?

      test text
      

      如果是这样,那么可能是“选择”导致它将相同的数据粘贴到同一个选择中,因此第二次粘贴会清除第一个。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-01-31
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多