简体   繁体   English

Delphi 7.0 DBGrid Ms-Word 超链接

[英]Delphi 7.0 DBGrid Ms-Word Hyperlink

Delphi,DBGrid,右键单击,复制我想要做的是在剪贴板上创建一个超链接,然后可以将其粘贴到 Word 中 连接到 DBGrid 单击事件

If what you are trying to do is copy a URL stored in a DBGrid Field you could do the following;如果您想要做的是复制存储在 DBGrid 字段中的 URL,您可以执行以下操作;

    BEGIN
    IF DBGrid1.Fields[YourFieldIndex].IsNull THEN
      ShowMessage('Empty field, nothing to copy!')
    ELSE
      clipboard.astext := DBGrid1.fields[YourFieldIndex].asstring
    END;

Include in your Uses clipbrd;包括在您的使用中

If you don't want to include clipbrd you could do it a quick and dirty way using a standard Edit Box.如果您不想包含 clipbrd,您可以使用标准的编辑框以一种快速而肮脏的方式来完成。

Begin
  Edit1.text := DBGrid1.fields[YourFieldIndex].asstring;
  Edit1.CopyToClipboard
End;

Put the chosen method into the OnClick event for a popup menu or where ever you need it.将所选方法放入弹出菜单的 OnClick 事件中或任何您需要的地方。

Assuming the contents of the field is a valid URL you can paste it anywhere you want, word documents, excel, whatever.假设该字段的内容是一个有效的 URL,你可以将它粘贴到任何你想要的地方,word 文档,excel 等等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM