简体   繁体   English

如何在MS-Word中使用域代码创建动态超链接?

[英]How to create dynamic hyperlink using Field Codes in MS-Word?

I am trying to add a hyperlink to a field code in MS-Word, but I want the same field code to populate as part of a search query in the url. 我正在尝试向MS-Word中的域代码添加超链接,但我希望将相同的域代码填充为url中搜索查询的一部分。 More relevant info below: 以下是更多相关信息:

For Instance, this field code is linked to a form and will populate with a tracking number pulled from an inventory database «TrackingNumber», but then I want to link this generated tracking number into a url query is as follows: 对于实例,此域代码链接到一个表单,并将填充从库存数据库“ TrackingNumber”中提取的跟踪号,但是随后我想将此生成的跟踪号链接到url查询中,如下所示:

HYPERLINK " https://www.google.com/searchq= «TrackingNumber»" HYPERLINK“ https://www.google.com/searchq=«TrackingNumber »”

Is this even possible? 这有可能吗? And if so, how should I configure? 如果是这样,我应该如何配置?

By default, if you insert a mailmerge field into a hyperlink field, the hyperlinks will all show the first record's address as the 'Text to display' text, even though the hyperlinks will actually point to the merged targets. 默认情况下,如果您在超链接字段中插入mailmerge字段,则即使超链接实际上指向合并的目标,超链接也会全部将第一条记录的地址显示为“要显示的文本”文本。

Here's how you can do get a mailmerge to display your preferred default 'Text to display' text instead: 您可以通过以下方式获取邮件合并以显示首选的默认“要显示的文本”文本:

  1. Disregarding mergefield issues for the moment, insert a hyperlink into the document in the normal way, choosing whatever 'Click Here' text you want in the 'Text to display' box. 暂时不考虑合并域问题,以常规方式在文档中插入超链接,然后在“要显示的文本”框中选择所需的“单击此处”文本。

  2. Select the inserted hyperlink and press Shift-F9 to expose its field code. 选择插入的超链接,然后按Shift-F9公开其域代码。

  3. Replace everything in the field between '=' and '"' with your «TrackingNumber» mergefield. 用您的«TrackingNumber»合并域替换“ =”和“”之间的所有内容。

  4. Select the field and press F9 to update the display. 选择该字段,然后按F9更新显示。

In Word 2007 & later, you can make the display text variable also, by following these additional steps: 在Word 2007及更高版本中,还可以通过执行以下附加步骤来使显示文本变量:

  1. Position the cursor anywhere within the display text. 将光标放在显示文本内的任何位置。

  2. Insert a mergefield pointing to whatever data field you want to use for the display text (this could even be the «TrackingNumber» mergefield). 插入一个合并域,指向要用于显示文本的任何数据域(甚至可以是《 TrackingNumber》合并域)。

  3. Delete all of the previous display text either side of your last-inserted mergefield (note that this field will likely have updated already). 删除最后插入的mergefield两侧的所有先前的显示文本(请注意,此字段可能已经更新)。

  4. Execute the merge. 执行合并。

  5. After merging to a new document, use Ctrl-A, F9 to update all fields. 合并到新文档后,使用Ctrl-A,F9更新所有字段。 Without this, the mergefield hover text won't update to the correct targets. 没有这个,mergefield悬停文本将不会更新到正确的目标。

Note 1: The above is only for merged output sent to a new document; 注意1:以上内容仅适用于发送到新文档的合并输出; it does not work with merges to email or print. 它不适用于合并到电子邮件或打印。 For merges to email, see: https://support.microsoft.com/en-us/kb/912679 有关合并到电子邮件的信息,请参见: https : //support.microsoft.com/en-us/kb/912679

Note 2: Hyperlink fields modified this way are liable to cease functioning once the merge has been executed. 注意2:以这种方式修改的超链接字段在执行合并后可能会停止运行。 Accordingly, it's best to save mailmerge main document before doing the merge and not re-save it afterwards. 因此,最好在合并之前保存mailmerge主文档,而不要在以后重新保存它。 If you need to make changes to the mailmerge main document, don't make/save them after doing a merge; 如果您需要对mailmerge主文档进行更改,请不要在合并后进行更改/保存; make/save them beforehand. 预先制作/保存它们。

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

相关问题 如何使用OpenXML修改单词超链接 - How to modify word hyperlink with OpenXML 在 MS Word 中使用宏来替换包含“#”和“!”的超链接文本 - In MS Word use macro to replace hyperlink text containing "#" and "!" 如何使用 JasperSoft Studio 创建超链接作为静态文本的一部分? - How to create a Hyperlink as part of a static text using JasperSoft Studio? 如何在Google表格中创建超链接 - How to create a hyperlink in Google Sheets Struts2使用Arraylist生成动态超链接 - Struts2 Dynamic hyperlink generation using Arraylist MS Word 2010邮件合并:动态url,相同文本 - MS Word 2010 mail merge: dynamic url, same text 如何使用PHP创建动态/友好的URL? - How to create dynamic/friendly URLs using PHP? 使用JavaScript和jQuery获取超链接字段/列以从SharePoint列表中将数据显示为超链接 - Getting a hyperlink field/column to display data as a hyperlink from a SharePoint List, using JavaScript and jQuery SSDT 在表达式中使用多个输入字段来创建超链接 - SSDT using multiple input fields in expression to create hyperlink 如何创建将超链接合并到字符串的angular表单? - How do I create a form in angular that merges a hyperlink to a string?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM