设计要合并的表单

注意:  我们希望能够尽快以你的语言为你提供最新的帮助内容。 本页面是自动翻译的,可能包含语法错误或不准确之处。我们的目的是使此内容能对你有所帮助。可以在本页面底部告诉我们此信息是否对你有帮助吗? 请在此处查看本文的 英文版本 以便参考。

With form merging, your users can consolidate data from many different forms into one form. This is useful when your users want to compare or summarize data from several related forms. For example, it can be useful for a manager whose team fills out weekly status report forms to merge data from those forms into a single summary report for her director.

本文内容

Ways that users can merge forms

设计注意事项

用于域和组的合并操作

Defining custom merge settings for controls

Ways that users can merge forms

The location of a form determines how a user can merge it with other forms. The following list explains the different locations where Microsoft Office InfoPath forms can be stored and how users can merge forms that are stored in those locations:

  • Local hard disk drive or a network location    A user must first open a form in InfoPath. This form is called the target form because it is the form into which the other forms will be merged. The user then clicks Merge Forms on the File menu, and selects additional forms — called source forms — to merge with the target form.

    注意: You can also open a new, blank form, and then use the same procedure to merge the blank form with additional forms that are based on the same form template.

  • Document library on a SharePoint site    Forms can be stored in a document library on a Windows SharePoint Services 3.0, Microsoft Office SharePoint Server 2007, or Microsoft Office Forms Server 2007 site. On the View menu in the document library where the forms are stored, a user can select the Merge Documents view, and then select the forms that she wants to merge. When merging forms in this way, it is not necessary for a user to first open a target form as described in the previous example.

    注意: When you design a 浏览器兼容的表单模板, users can fill out forms that are based on that form template by using a Web browser. The procedure for merging forms in a SharePoint library that are based on browser-compatible form templates is the same as merging forms that users open and fill out in InfoPath.

  • InfoPath e-mail forms in Microsoft Office Outlook 2007    A user can merge multiple forms from within Office Outlook 2007 by selecting them in the view of the folder where the forms are stored, and then clicking Merge Forms on the Actions menu.

注意: When users merge forms, the original forms are not deleted. The data from the merged forms is added to the target form. It is recommended that users save the target form, with merged data, as a new form so as not to overwrite the data in the original form.

Top of Page

设计注意事项

Now that you are familiar with the ways that users can merge forms based on a form's location, it is important to understand how you can enable specific controls to support merging, and how data from individual fields is combined when forms are merged. This information — along with an understanding of how your users plan to use merged data — is a key part of creating form templates that enable users to can easily merge forms.

将控件添加到表单模板时,它是绑定到域或组中的表单模板数据源。如果您要设计新,空白表单模板创建数据源是为您添加控件时。如果您要设计表单模板基于外部数据源,如 XML 架构或 Web 服务,您将添加到表单模板的控件必须绑定到该数据源中域或组。

When you enable merge settings for a control, you actually enable merge settings for the field or group that the control is bound to. The merge settings vary depending on the field or group and its data type. Certain types of fields or groups do not support merging.

To better understand how form merging works, imagine that you designed an expense report form template that contains a text box control bound to a non-repeating field in the data source that uses a text data type. This field is used to store each user's business justification for the recorded expenses. For this example, we will call the field purpose and bind the text box control with the label Business Purpose to it.

Imagine that three users — Bob Kelly, Nate Sun, and Judy Lew — are filling out forms based on your form template. In the Business Purpose field, Bob types Conference, Nate types Customer Visit, and Judy types Business Trip. Because text box controls that use a text data type do not support the merging of data by default, a manager who merges these expense report forms will only see one value in the Business Purpose field — the value that was already contained in the target form. So, for example, if Judy's form is the target form, only the value that Judy entered will appear in the merged form for this field.

By customizing the merge settings for the field or group that a control is bound to, users can merge that field's or group's data from multiple forms. In this example, you can customize the merge settings for the Business Purpose text box control so that users can merge data from the forms that contain that field. You can customize the merge settings further by enabling a separator to appear between each merged value. A separator can be a space, a comma, a semicolon, a vertical line, a line break, a paragraph break, or an underline. For example, if Bob types Conference in the Business Purpose field, Nate types Customer Visit, and Judy types Business Trip, and you enable merging for that field, and specify a comma separator, the resulting merged data will display as Business Trip, Customer Visit, Conference (if Judy's form is the target form).

注意: A space is automatically added after comma and semicolon separators.

While adding a separator can help distinguish between specific values, you can further customize how data is merged by adding a unique prefix to each value that is contained in a field or group. When adding a prefix, you can select the value from another field, or enter a 函数 that you want to use as a prefix. Adding a prefix can help your users identify the source of the original data. For example, you can enable the name of the person who filled out a form — a value that is entered in another field  — to appear as a prefix for a value contained in another field. Then, when several forms are merged, the values from the source form will display merged values, and those values will have identifiers.

For example, if you identify a field that stores a user's name as the prefix, and create a concat function that adds a colon after each instance of that value, users can easily see who entered a value even after several forms are merged. In this example, if Judy Lew's form is the target form, the resulting prefixed data will appear as Business Trip, Nate Sun: Customer Visit, Bob Kelly: Conference.

注意: 

  • 前缀不会添加到目标窗体-吕玉笛窗体中的,在这种情况下,以避免添加多余前缀,如果合并的数据保存在表单中,并且窗体然后再次合并。

  • When a user merges InfoPath forms that are located on a hard disk drive or a network location, a SharePoint site, or InfoPath e-mail forms in Office Outlook 2007, the resulting merged data is shown in reverse order from the order that the forms were selected. For example, if a user selects three forms, starting with Bob's, then selects Judy's, and then Nate's, in the resulting form that contains merged data, Nate's data will appear first, followed by Judy's data, and then Bob's.

  • In addition to customizing merge settings for individual controls, you can also disable form merging for the entire form template to prevent users from merging forms that are based on it. When you disable form merging, users who fill out the form do not have access to the Merge Forms command on the File menu.

  • To ensure that your form template is configured correctly to merge other forms, test it by publishing the form template, and then creating and saving at least five forms based on the form template with sample data. After saving the forms, open the form template in design mode, and then click Preview on the Standard toolbar.. In preview mode, merge your sample forms. If the forms merge correctly, you can publish the form template and allow your users to create forms based on your form template.

  • 向用户提供有关如何合并表单的过程。测试表单模板中的合并时,您可以开发此过程。

Top of Page

用于域和组的合并操作

下列的合并操作有所不同,具体取决于域或组的数据类型。

配置域或组的任何类型的合并设置时,您可以选择忽略的源窗体中的值并保留值中的目标窗体,或选择自定义合并设置。下表介绍了每种类型的域或组的自定义合并设置。

域或组的类型

可用的合并设置

可以绑定到此字段类型的控件的示例

非重复域

  • 在目标窗体的源窗体中的值的值组合在一起

    • 忽略空字段

    • 添加项之间的分隔符

    • 向每个项目添加前缀

  • 文本框

  • 下拉列表框

  • 组合框

重复域

  • 插入来自源表单的值之前, 或之后目标窗体中的值

    • 删除空字段

  • 项目符号列表

  • 编号列表

  • 普通列表

  • 多选列表框

非重复 XHTML 域

  • 在目标窗体的源窗体中的值的值组合在一起

    • 忽略空字段

    • 添加项之间的分隔符

    • 向每个项目添加前缀和前缀文本设置格式

格式文本框

重复 XHTML 域

  • 插入来自源表单的值之前, 或之后目标窗体中的值

    • 删除空字段

  • 项目符号列表

  • 编号列表

  • 普通列表

  • 重复表

属性字段

  • 将目标窗体中的值替换为源窗体中的值

    如果用户选择多个窗体,用户选择的最后一个窗体中的值将保留在目标窗体中的值。例如,如果用户选择三个窗体,吕,然后熊的开头 Bob,然后选择,来自熊的窗体中的属性字段的数据将替换目标窗体中的原始值。

    注意: 根据合并表单的操作系统,保留的值可能会有所不同。

  • 在目标窗体的源窗体中的值的值组合在一起

    • 忽略空字段

    • 添加项之间的分隔符

    • 向每个项目添加前缀

任何控件都可以有了属性的字段类型。

非重复组

  • 在目标窗体的源窗体中的值的值组合在一起

  • Optional section

Repeating group

  • Insert the values from the source forms before or after the value in the target form

    • Remove blank fields

  • 项目符号列表

  • 编号列表

  • 普通列表

  • Multiple-selection list box

  • 重复表

Top of Page

定义自定义合并控件设置

使用本部分中的过程来定义标准和重复控件的自定义合并设置。

注意: 当您启用控件的合并设置时,您实际上启用的字段或控件绑定到的组的合并设置。合并设置会有所不同,具体取决于域或组和其数据类型。某些类型的域或组不支持合并。您也可以通过编辑字段或数据源中的组的属性更改合并设置。若要执行此操作,域或组在数据源任务窗格中的右键单击,在快捷菜单上,单击属性,然后单击规则和合并选项卡中的合并设置

标准控件包括您通常关联收集和显示信息的控件。这些控件包括文本框、 列表框、 复选框和按钮。重复和可选控件包括列表控件,重复表、 重复节和可选节。这些控件允许用户在填写表单时插入列表项、 行、 记录集和可选的信息。例如,在零用金报销单表单模板中,您可以使用重复表若要允许用户根据需要输入其特定数目的支出项目添加为多行。

注意: 

  • 某些控件绑定到不能合并的字段。例如,不能合并中的日期选取器控件或复选框控件的值,因为它们包含的数据类型不能合并。从不可以合并包含数字签名的控件,因为这样做将使数字签名。

  • 某些控件包含其他选项。例如,在自定义格式文本框控件的合并设置,您可以选择字体格式选项。

定义自定义合并标准控件设置

标准控件包括文本框、 格式文本框和组合框。在本文的详细信息,请参阅用于域和组的合并操作

注意: 在节内添加的控件 — 换言之,子控件的父控件 — 仅支持合并如果它已启用父控件。

  1. 双击要修改的控件。

  2. 控件属性对话框中,单击高级选项卡。

  3. 合并窗体中,单击合并设置

  4. 操作的此字段中,单击合并目标窗体的源窗体中的值中的值

  5. 若要排除字段不包含数据,在合并选项下的选择忽略空字段 (推荐)复选框。

  6. 单独的每个项目的列表中,选择目标窗体中显示的控件中的值之间出现的分隔符。

    Technical details

    Adding a separator can help your users determine the user that entered data when data from multiple forms are merged. For example, choosing Comma (",") for a particular control will result in data from that control being separated by commas when multiple forms based on the form template are merged.

  7. To add a prefix before each value that appears in the control when users merge forms based on this form template, select the Prefix each item with check box, and then choose an item that you want to base the prefix on.

    操作方法

    1. 单击插入公式 公式按钮

    2. 插入公式对话框中,执行下列操作之一:

      • 若要使用公式中的字段,单击插入域或组,单击您想要使用选择域或组对话框中的字段,然后单击确定

      • 若要在公式中使用函数,单击插入函数,选择您想要从插入函数对话框中,使用的函数,然后单击确定

        提示: 如果函数需要参数,在插入函数对话框中选择的函数,单击确定,然后在公式框中插入公式对话框中,双击您添加了,该函数并单击一个字段或组。在另请参阅部分找到有关函数的详细信息的链接。

      • 若要插入公式的值或数学运算符,请在公式框中键入值或数学运算符符号。

    运算

    符号

    添加

    +

    Subtract

    -

    Multiply

    *

    Divide

    /

    • 注意: 如果公式使用除法 (/) 运算符,请确保之前和之后除法运算符存在一个空格。如果除法运算符没有空间之前和之后,InfoPath 将解释"/"作为 XPath 位置步骤分隔符而不是作为除法运算符。

    • 若要检查的公式为正确的语法,在插入公式对话框中,单击验证公式

定义自定义合并设置标准节

Standard sections are containers for other controls. Sections can include any of the controls listed in the Controls task pane, including other sections. See Merge actions for fields and groups in this article for more information.

注意: 在节内添加的控件 — 换言之,子控件的父控件 — 仅支持合并如果它已启用父控件。

  1. 双击要修改的节。

  2. 节属性对话框中,单击高级选项卡。

  3. 合并窗体中,单击合并设置

  4. 此组的操作下, 单击合并的源和目标窗体中 (默认值) 的组的内容

    注意: 为每个域和组在此组的合并设置将决定如何合并数据。

定义自定义合并设置为重复控件和分区

重复控件包括重复节、 重复表和项目符号列表。在本文的详细信息,请参阅用于域和组的合并操作

注意: Controls that are added inside sections — in other words, child controls of parent controls — only support merging if it has been enabled for the parent control.

  1. Double-click the control that you want to modify.

  2. 控件属性对话框中,单击高级选项卡。

  3. 合并窗体中,单击合并设置

  4. Under Action for this repeating group, click Insert the groups from the source forms into the target form (default).

  5. To determine where the groups from the source forms will appear in the target form, under Insert options, click After groups in the target form or Before groups in the target form.

  6. To eliminate blank values from the merged forms, select the Remove blank groups (recommended) check box.

  7. To combine groups whose controls contain the same values, thereby reducing redundancy, select the Combine groups with the same field value check box, and then click the button next to Fields to compare to select the fields to combine.

定义自定义合并设置可选节

Optional sections contain other controls. Users can insert or remove optional sections when filling out a form. See Merge actions for fields and groups in this article for more information.

注意: Controls that are added inside sections — in other words, child controls of parent controls — only support merging if it has been enabled for the parent control.

  1. Double-click the control that you want to modify.

  2. In the Control Properties dialog box, click the Advanced tab.

  3. Under Merging forms, click Merge Settings.

  4. Under Action for this group, click Combine the contents of the groups in the source and target forms (default).

Top of Page

扩展你的 Office 技能
了解培训
抢先获得新功能
加入 Office 预览体验计划

此信息是否有帮助?

谢谢您的反馈!

谢谢你的反馈! 可能需要转接到 Office 支持专员。

×