Word 2010 - 邮件合并多个条件

Word 2010 - 邮件合并多个条件

我正在尝试让邮件合并处理某些条件,例如:如果合并字段配偶 = 1 且合并字段律师 = 2 且合并字段子女 = 3 且合并字段父母 = 4,则添加某些文本

或者

如果合并字段配偶 = 1 且合并字段律师 = 0 且合并字段子女 = 2 且合并字段父母 = 0,则添加此文本

等等因此,取决于合并字段的顺序将取决于文本添加

我尝试了以下操作但似乎不起作用 { IF{=OR({COMPARE { MERGEFIELD "Spouse "}= "0"}, { COMPARE { MERGEFIELD "lawyer"} = "1" { COMPARE {MERGEFIELD "Children "}= "0" }, { COMPARE { MERGEFIELD "Parent"}= "0" })} = "1" "Lawyer Text" ""}

或 { IF{=OR({COMPARE { MERGEFIELD "配偶 "}= "1"}, { COMPARE { MERGEFIELD "律师"} = "3" { COMPARE { MERGEFIELD "儿童 "}= "2" }, { COMPARE { MERGEFIELD "父母"}= "0" })} = "1" "家庭 1 文本" ""}

或者

{ IF{=OR({比较 { MERGEFIELD "配偶 "}= "1"}, { 比较 { MERGEFIELD "律师"} = "0" { 比较 { MERGEFIELD "子女 "}= "2" }, { 比较 { MERGEFIELD "父母"}= "3" })} = "1" "家庭第一文本" ""}

答案1

基本IF语法,可以嵌套测试多个条件。

单一条件(基本):

{IF {MERGEFIELD FIELD1} = "CONDITION1" "TRUE" "FALSE"}

两个条件:

{IF {MERGEFIELD FIELD1} = "CONDITION1" "{IF {MERGEFIELD FIELD2} = "CONDITION2" "TRUE" "FALSE2"}" "FALSE1"}

你的例子:

{IF {MERGEFIELD SPOUSE} = "1" "{IF {MERGEFIELD LAWYER} = "0" "{IF {MERGEFIELD CHILDREN} = "2" "{IF {MERGEFIELD PARENT} = "0" "add this text" ""}" ""}" ""}" ""}

相关内容