![微软文本检索](https://i-blog.csdnimg.cn/blog_migrate/69d070274c106f661445a7747fa62623.png)
微软文本检索
![00_lead_image_common_information](https://i-blog.csdnimg.cn/blog_migrate/daff8ffb959f0ca81ecf48dd19f8521a.png)
You probably have some text that you type often in your Word documents, such as addresses. Instead of retyping this text every time you need it, you can put this common text into one Word document and reference it in other documents–it’ll even automatically update in all your documents if you change it.
您可能有一些经常在Word文档中键入的文本,例如地址。 您可以将此通用文本放入一个Word文档中,并在其他文档中进行引用,而不必每次都重新键入该文本,如果更改,它甚至会在所有文档中自动更新。
Say you want to put your address in the footer of your documents, but the address changes from time to time. You can store the address in a separate, common Word document and use a field in your report to pull the text from the common document, and update whenever it changes. We’ll show you how to do this.
假设您想将地址放在文档的页脚中,但是地址会不时更改。 您可以将地址存储在单独的通用Word文档中,并在报告中使用字段从通用文档中提取文本,并在更改时进行更新。 我们将向您展示如何执行此操作。
To begin, create a new Word document that will serve as your repository for the address you want to insert into other Word documents. Save it in a location that will be accessible by other documents. For example, don’t save it on a network drive to which you don’t always have access.
首先,创建一个新的Word文档,它将用作您要插入其他Word文档中的地址的存储库。 将其保存在其他文档可以访问的位置。 例如,不要将其保存在并非总是具有访问权限的网络驱动器上。
We’re going to use bookmarks to refer to the address in our common document. Type the string of text you want to insert into other documents (in our case, the address). Create a bookmark by highlighting the name and going to Insert > Bookmark and giving it a name, like “Address”. See our guide to bookmarks in Word for information on creating them.
我们将使用书签来引用我们的普通文档中的地址。 键入要插入其他文档的文本字符串(在我们的示例中为地址)。 通过突出显示名称并转到插入>书签并为其命名,例如“地址”,来创建书签。 有关创建书签的信息,请参见Word中的书签指南。
Note that bookmark names cannot have any spaces. We recommend putting the name of the bookmark above each item in your common information file so you easily know which name to use for which item. This is especially useful if you plan to have a lot of reusable items in this common document. In our example, we added our address to the common information document and put the bookmark name, “Address”, above the item.
请注意,书签名称不能有任何空格。 我们建议将书签的名称放在公共信息文件中每个项目的上方,以便您轻松知道要为哪个项目使用哪个名称。 如果您打算在此公共文档中有很多可重复使用的项目,则此功能特别有用。 在我们的示例中,我们将地址添加到公共信息文档中,并将书签名称“地址”放在项目上方。
![01_creating_bookmark_in_common_file](https://i-blog.csdnimg.cn/blog_migrate/64a77fdaf9b73faf5e1b199cdcd5a0ca.png)
Once you’ve added the item to your common document, you can save and close. Open the document in which you want to insert the address and position the cursor where you want that text to go. For our example, we’re going to add a footer and insert the address there.
将项目添加到普通文档后,即可保存并关闭。 打开您要在其中插入地址的文档,然后将光标置于您要输入文本的位置。 对于我们的示例,我们将添加一个页脚并在其中插入地址。
![02_placing_cursor_in_footer](https://i-blog.csdnimg.cn/blog_migrate/258403b7b46938328304393626906778.png)
We’re going to use the INCLUDETEXT field code to refer to the bookmark we created in the common document. To do this, press “Ctrl + F9” to insert the brackets for the field code.
我们将使用INCLUDETEXT域代码来引用我们在通用文档中创建的书签。 为此,请按“ Ctrl + F9”以插入域代码的括号。
NOTE: You cannot just type normal brackets around field codes. You must use “Ctrl + F9” to insert the correct type of brackets.
注意:您不能只在域代码周围输入普通括号。 您必须使用“ Ctrl + F9”插入正确的括号类型。
![03_pressing_ctrl_f9_for_brackets](https://i-blog.csdnimg.cn/blog_migrate/3c349f2cb728638793cec25e82fd7616.png)
The cursor is automatically placed in between the brackets. Type the following text between the brackets, replacing the “<path to file>” with the absolute full path to your common Word containing the name you want to insert. Replace “<bookmark name>” with the bookmark name you assigned to the item in the common document.
光标会自动放在括号之间。 在方括号之间键入以下文本,将“ <文件路径>”替换为包含要插入名称的通用Word的绝对完整路径。 将“ <书签名称>”替换为您为普通文档中的项目分配的书签名称。
INCLUDETEXT "<path to file>" <bookmark name>
NOTE: Do not enter the brackets in the field code.
注意:请勿在域代码中输入括号。
For example, we typed the following in between the field code brackets:
例如,我们在域代码括号之间键入以下内容:
INCLUDETEXT "C:\\Users\\Lori\\Documents\\Common Information\\CommonInformation.docx" Address
NOTE: You must use double backslashes in the path, like we did. Also, make sure you use straight quotes, not smart quotes, when typing the above code into the field.
注意:必须像我们一样在路径中使用双反斜杠。 另外,在字段中键入上述代码时,请确保使用直引号而不是智能引号。
![04_entering_includetext_field_code](https://i-blog.csdnimg.cn/blog_migrate/69a4b7a20491b2d2340bf6a99db530ab.png)
To grab the address from the common document and insert it into the field code you just entered, right-click on the field code and select “Update Field” from the popup menu.
要从通用文档中获取地址并将其插入刚输入的域代码中,请右键单击该域代码,然后从弹出菜单中选择“更新域”。
![05_selecting_update_field](https://i-blog.csdnimg.cn/blog_migrate/2549d70e93020d5edb35c873484fc723.png)
The address displays in the document. Brackets still display around the address if you have the “Show bookmarks” option on. Again, see our article about bookmarks to learn how to turn off this option. Also, the field code might be shaded. However, you can also turn this off.
地址显示在文档中。 如果您启用了“显示书签”选项,则括号仍会显示在地址周围。 同样,请参阅我们有关书签的文章,以了解如何关闭此选项。 此外,该域代码可能会被加阴影。 但是,您也可以关闭此功能。
![06_text_inserted](https://i-blog.csdnimg.cn/blog_migrate/7c8101913bb96069b0764dc0bd207a7b.png)
If you want to change the field code, you can display the code again rather than the result. To do this, right-click on the resulting item and select “Toggle Field Codes” from the popup menu. The text you typed into the field code displays again and you can edit it. Simply, update the field to display the new result.
如果要更改域代码,可以再次显示该代码而不是结果。 为此,右键单击生成的项目,然后从弹出菜单中选择“切换域代码”。 您在域代码中键入的文本将再次显示,您可以对其进行编辑。 只需更新字段以显示新结果。
![07_selecting_toggle_field_codes](https://i-blog.csdnimg.cn/blog_migrate/3315930afe141c45762c7d27eaaa8959.png)
Once you’ve created your common document, you can use it to store other items you often type into your Word documents. Simply use a separate INCLUDETEXT field in your Word documents for each piece of information you want to automatically insert from your common document.
一旦创建了通用文档,就可以使用它存储您经常在Word文档中键入的其他项目。 只需在Word文档中使用单独的INCLUDETEXT字段,即可获取要从普通文档中自动插入的每条信息。
翻译自: https://www.howtogeek.com/240026/how-to-reference-text-from-other-documents-in-microsoft-word/
微软文本检索