Variables (fields)

目录

# 变量

可以使用变量字段在文档中加入动态内容。例如，可以使用变量重置页码。

要访问此命令...

#### From the menu bar:

Choose Insert - Field - More Fields - Variables tab

#### From the tabbed interface:

On the Insert tab, choose Field - More Fields - Variables tab.

Field

#### From the keyboard:

Ctrl + F12

To add a field to your document, click a field type, click a field in the Select list, and then click Insert.

## Type

Lists the available Variable field types.

类型 | 说明
--- | ---
设置变量 | Defines a variable and its value. You can change the value of a variable by clicking in front of the variable field, and then choosing Edit - Field. By default, all variables are created of numeric type. When you insert a Set Variable field into the document for the first time, you need to define its format in the Format area. The format can be either text or numeric, with various number formats available. Once defined, you cannot change the format unless you remove the variable from the document. By default, all variables are created of numeric format.
显示变量 | Inserts the current value of the variable that you click in the Select list.
DDE 字段 | 在文档中插入 DDE链接至文档，可以通过指定的名称随时更新此链接。
插入公式 | 插入固定的数字或公式的计算结果。 When a variable is created with a numeric value, its content is interpreted as a formula, and the result is automatically converted to a number. Plain text enclosed in quotes evaluates to 0, but if you enter a mixed string like "123a456", the conversion stops at the first non-numeric character—resulting in the number 123. The formula expression follows the rules for formulas in tables, using variables defined in the document rather than table cells.
输入字段 | 插入变量或用户字段的新值。 输入字段中变量的值仅在自该字段插入位置起向前的范围有效。要在文档中稍后的位置修改变量值，需要插入另一个名称相同但值不同的输入字段。但用户字段的值会发生全局性修改。 The variables are displayed in the Select field. When you click the Insert button, the dialog Review Fields appears, where you can enter the new value or additional text as a remark.
编号范围 | Inserts automatic numbering for tables, graphics, or frames.
设置页面变量 | 在文档中插入一个参照点。在这个参照点之后，页面重新开始计数。选择「打开」启用此参照点，选择「关闭」将其禁用。您也可以在「修改」中输入值，使页面从不同的值开始计数。
Show page variable | 显示从「设置页面变数」参照点到此字段之间的页数。
用户字段 | 插入自定义的全局变量。您可以使用「用户字段」定义条件语句的变量。修改「用户字段」时，文档中此变量的所有实例都会更新。

## 选择

Lists the available fields for the field type selected in the Type list. To insert a field, click the field, and then click Insert.

To quickly insert a field from the Select list, hold down CommandCtrl and double-click the field.

### 格式

If a field is displaying a date, time or number, then Format is used to customize the appearance of the date, time, or number. Common formats are shown in the Format window, or click "Additional formats" to define a custom format.

### 名称

Type the name of the user-defined field that you want to create. This option is available for "Set variable", "DDE field", "Number range" and "User Field" field types.

自定义字段只能在当前文档中使用。

### Value

Enter the contents that you want to add to a user-defined field.

在「格式」列表中，定义该值是作为文本插入还是作为数字插入。

The following fields can only be inserted if the corresponding field type is selected in the Type list.

在 HTML 文档中，「设置变量」字段类型有两个其他的字段可用: HTML_ON 和 HTML_OFF。当文件保存为 HTML 文档时，根据您选择的选项，「数值」框中的文字将转换为 HTML 起始标记 (<Value>) 或 HTML 终止标记 (</Value>)。

## DDE Statement

DDE 命令的通用语法是: "<Server> <Topic> <Item>"。其中，Server 是含有数据的应用程序的 DDE 名称，Topic 是指 Item (通常是文件名称) 的位置，Item 表示实际的对象。

This option is only available if the "DDE field" field type is selected.

## 公式

This option is only available if the "Insert Formula" field type is selected.

### 参照

输入您想要在该字段上显示的文本。如果您是插入占位符，则输入您想要在鼠标停留在占位符上时显示的提示信息。

#### 修改

输入要应用到页码字段的偏移值，例如，"+1"。

This option is only available if the "Set page variable" field type is selected.

## 不可见

Hides the field contents in the document. The field is inserted as a thin gray mark in the document. This option is only available for the "Set Variable" and "User Field" field types.

## With Heading Number

Use this option to display a heading number before a “number range” field. The heading number comes from a heading prior to the location of the field.

### Up to level

With typical use of headings in the document, the selected number will indicate how many levels of heading number (starting from level 1) to display. The selected value indicates the maximum number of levels to show. The actual number may have fewer levels. For example, if the immediately prior heading number is 2.6, and 4 is selected, then only 2.6 is displayed . If [None] is selected, no heading number is displayed.

The heading number selected for display is the first prior heading whose outline level is equal to or less than the selected outline level. For example, select “2” to use the heading number of the first prior heading with outline level 1 or outline level 2.

### 分隔符

Specify the character to use as a separator between the heading number and the field number.

With Heading Number, Up to level and Separator are only available for the “Number range” field type.

## 应用

Adds the user-defined field to the Select list.

应用

## 删除

Removes the user-defined field from the select list. You can only remove fields that are not used in the current document. To remove a field that is used in the current document from the list, first delete all instances of the field in the document, and then remove it from the list.

删除

请支持我们!