home *** CD-ROM | disk | FTP | other *** search
- <?xml version="1.0" encoding="utf-8"?>
- <html><head><title>条件的设定</title><meta name="filename" content="text/swriter/01/04090200"/><meta name="language" content="zh-CN"/><help:css-file-link xmlns:help="http://openoffice.org/2000/help"/><!--The CSS style header method for setting styles--><style type="text/css">
-
- table.Tabelle1{
- margin-left:0cm; margin-right:0.005cm;}
- span.Tabelle1A{
- width:1.905cm;}
- span.Tabelle1B{
- width:16.09cm;}
- td.Tabelle1A1{
- }
- td.Tabelle1B1{
- border-width:0.002cm; border-style:solid; border-color:#000000;}
- td.Tabelle1A2{
- }
- td.Tabelle1B2{
- }
- table.Tabelle9{
- }
- span.Tabelle9A{
- width:1.499cm;}
- span.Tabelle9B{
- width:16.501cm;}
- tr.Tabelle91{
- }
- td.Tabelle9A1{
- }
- table.Tabelle3{
- margin-left:0cm; margin-right:0.005cm;}
- span.Tabelle3A{
- width:2.223cm;}
- span.Tabelle3B{
- width:15.773cm;}
- td.Tabelle3A1{
- }
- td.Tabelle3B1{
- border-width:0.002cm; border-style:solid; border-color:#000000;}
- td.Tabelle3A2{
- }
- td.Tabelle3B2{
- }
- table.Tabelle4{
- margin-left:0cm; margin-right:0.005cm;}
- span.Tabelle4A{
- width:4.023cm;}
- span.Tabelle4B{
- width:13.972cm;}
- td.Tabelle4A1{
- }
- td.Tabelle4B1{
- border-width:0.002cm; border-style:solid; border-color:#000000;}
- td.Tabelle4A2{
- }
- td.Tabelle4B2{
- }
- table.Tabelle2{
- }
- span.Tabelle2A{
- width:1.499cm;}
- span.Tabelle2B{
- width:16.501cm;}
- tr.Tabelle21{
- }
- td.Tabelle2A1{
- }
- table.Tabelle10{
- margin-left:0cm; margin-right:0.005cm;}
- span.Tabelle10A{
- width:4.2cm;}
- span.Tabelle10B{
- width:13.795cm;}
- td.Tabelle10A1{
- }
- td.Tabelle10B1{
- border-width:0.002cm; border-style:solid; border-color:#000000;}
- td.Tabelle10A2{
- }
- td.Tabelle10B2{
- }
- table.Tabelle5{
- margin-left:0cm; margin-right:0.005cm;}
- span.Tabelle5A{
- width:8.573cm;}
- span.Tabelle5B{
- width:9.423cm;}
- td.Tabelle5A1{
- }
- td.Tabelle5B1{
- border-width:0.002cm; border-style:solid; border-color:#000000;}
- td.Tabelle5A2{
- }
- td.Tabelle5B2{
- }
- table.Tabelle6{
- }
- span.Tabelle6A{
- width:1.499cm;}
- span.Tabelle6B{
- width:16.501cm;}
- tr.Tabelle61{
- }
- td.Tabelle6A1{
- }
- table.Tabelle7{
- }
- span.Tabelle7A{
- width:1.499cm;}
- span.Tabelle7B{
- width:16.501cm;}
- tr.Tabelle71{
- }
- td.Tabelle7A1{
- }
- table.Tabelle8{
- }
- span.Tabelle8A{
- width:1.499cm;}
- span.Tabelle8B{
- width:16.501cm;}
- tr.Tabelle81{
- }
- td.Tabelle8A1{
- }
- p.P1{
- }
- p.P2{
- }
- p.P3{
- }
- span.T1{
- font-weight:bold;}
- span.fr1{
- }
- </style></head><body>
-
-
- <p class="P1"/>
- <p class="Head1"><help:key-word value="逻辑表达式; 字段指令" tag="kw67700_4" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="条件; 设定" tag="kw67700_14" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="条件; 在字段指令中" tag="kw67700_13" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="字段指令; 条件" tag="kw67700_12" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="有条件的字段指令" tag="kw67700_11" xmlns:help="http://openoffice.org/2000/help"/>条件的设定</p>
- <p class="Paragraph">有些命令是与一定的条件相联系的,这样就能控制文档内容的输出。在<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Writer中,条件主要通过<help:link Id="67633" xmlns:help="http://openoffice.org/2000/help">字段指令</help:link>进行设定,但即使是显示被定义的<help:link Id="67749" xmlns:help="http://openoffice.org/2000/help">区域</help:link>也可以与一定的条件相联系。条件的语法将在下文中结合字段指令进行说明,这些说明也完全可以套用到区域上。因为条件是逻辑表达式,它们的语法在<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Writer中无论上下文如何,都是相同的。</p>
- <p class="Paragraph">对于字段指令,条件可以针对下列字段类型进行设定:</p>
- <ul class="L1">
- <li class="">
- <p class="P2"><help:key-word value="有条件的文字" tag="kw67700_1" xmlns:help="http://openoffice.org/2000/help"/>有条件的文字:插入的文字取决于一个条件。如果该条件为真,则插入文字A,否则便插入替代文字B。</p>
- </li>
- <li class="">
- <p class="P2"><help:key-word value="隐入的文字" tag="kw67700_3" xmlns:help="http://openoffice.org/2000/help"/>隐入的文字:如果条件为真,则插入文字被隐藏。</p>
- </li>
- <li class="">
- <p class="P2"><help:key-word value="隐入的段落" tag="kw67700_2" xmlns:help="http://openoffice.org/2000/help"/>隐入的段落:如果条件为真,则文档中的一个段落被隐藏。</p>
- </li>
- <li class="">
- <p class="P2">任意一个和下一个数据条目:该数据库字段中的条件控制从一个或多个数据库中读取数据,将它们插入到文档中。</p>
- </li>
- </ul>
- <p class="Paragraph">原则上,条件必须总是一个逻辑表达式,因为条件的结果总是真(满足)或假(不满足)。如果一个逻辑表达式为假,则它在<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>中它的值为0(假),如果为真,则它的值不为0(真)。因此,输入条件文字最简单的方法是直接输入一个值:</p>
- <table border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" page-break-inside="page-break-inside:avoid"><tr class=""><td class="Tabelle1A1" style="text-align:left;"><span class="Tabelle1A">
- <p class="TextInTable">真</p>
- </span></td><td class="Tabelle1B1" style="text-align:left;"><span class="Tabelle1B">
- <p class="TextInTable">条件总是被满足。或者您也可以输入任意一个不等于0的值作为条件文字。</p>
- </span></td></tr><tr class=""><td class="Tabelle1A2" style="text-align:left;"><span class="Tabelle1A">
- <p class="TextInTable">σüç</p>
- </span></td><td class="Tabelle1B2" style="text-align:left;"><span class="Tabelle1B">
- <p class="TextInTable">条件不被满足。或者您也可以输入0值。</p>
- </span></td></tr></table>
- <p class="Paragraph"/>
- <table><tr class="Tabelle91"><th class="Tabelle9A1" style="text-align:left;"><span class="Tabelle9A">
- <p class="Paragraph"><draw:image draw:style-name="fr1" draw:name="HIND_1" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="4" xlink:href="65980" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
- </span></th><th class="Tabelle9A1" style="text-align:left;"><span class="Tabelle9B">
- <p class="Paragraph">空白的条件字段被定义为条件不被满足。如果文本框<span class="T1">条件</span>空白,则等同于输入假或0。</p>
- </span></th></tr></table>
- <p class="Paragraph">对一个条件的设定可以使用在编辑栏中用于设定公式的同一个<help:link Id="67808" xmlns:help="http://openoffice.org/2000/help">单元</help:link>:运算符、数学和统计学函数、数字格式、变量和常量。其中,比较运算符和逻辑<help:link Id="67808" Eid="operatoren" xmlns:help="http://openoffice.org/2000/help">运算符</help:link>是条件设定的基本单元。</p>
- <p class="Paragraph">条件的设定可以采用以下变量:</p>
- <ul class="L2">
- <li class="">
- <p class="P3">自定义变量(字段指令"变量设定"或使用者栏位)</p>
- </li>
- <li class="">
- <p class="P3">预设定<help:link Id="67808" Eid="variablen" xmlns:help="http://openoffice.org/2000/help">的<help:productname>%PRODUCTNAME</help:productname>变量</help:link>,它从文档属性中获得统计值</p>
- </li>
- <li class="">
- <p class="P3">使用者数据</p>
- </li>
- <li class="">
- <p class="P3">从数据库</p>
- </li>
- </ul>
- <p class="Paragraph">不可能将内部变量(页码、章等)用来作为条件。</p>
- <p class="Head2"><help:key-word value="字段指令; 条件" tag="kw67700_10" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="条件; 字段指令" tag="kw67700_9" xmlns:help="http://openoffice.org/2000/help"/>条件和变量</p>
- <p class="Paragraph">在条件中可以加入任意一个变量x。这时,x可以是您定义的字段指令名称("变量设置"或使用者栏位),它包含一个确定的值,或者是一个<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>变量,它的值取决于您的文档。示例:</p>
- <table border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" page-break-inside="page-break-inside:avoid"><tr class=""><td class="Tabelle3A1" style="text-align:left;"><span class="Tabelle3A">
- <p class="TextInTable">x == 1或x EQ 1</p>
- </span></td><td class="Tabelle3B1" style="text-align:left;"><span class="Tabelle3B">
- <p class="TextInTable">如果变量x等于1,则条件为真。例如,如果您希望设定一个条件,要求它顾及文档的页数,则可以输入"Page"代替x:Page == 1导致的结果是,当您的文档只包含一页时,条件为真。</p>
- </span></td></tr><tr class=""><td class="Tabelle3A2" style="text-align:left;"><span class="Tabelle3A">
- <p class="TextInTable">x != 1或x NEQ 1</p>
- </span></td><td class="Tabelle3B2" style="text-align:left;"><span class="Tabelle3B">
- <p class="TextInTable">如果变量x不等于1,则条件为真。</p>
- </span></td></tr><tr class=""><td class="Tabelle3A2" style="text-align:left;"><span class="Tabelle3A">
- <p class="TextInTable">sinx == 0</p>
- </span></td><td class="Tabelle3B2" style="text-align:left;"><span class="Tabelle3B">
- <p class="TextInTable">如果变量x是Pi的倍数,则条件为真。</p>
- </span></td></tr></table>
- <p class="Paragraph"/>
- <p class="Paragraph">比较运算符也可以应用于字符串。该字符串必须另外加上双引号:</p>
- <table border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" page-break-inside="page-break-inside:avoid"><tr class=""><td class="Tabelle4A1" style="text-align:left;"><span class="Tabelle4A">
- <p class="TextInTable">x == "ABC"或x EQ "ABC"</p>
- </span></td><td class="Tabelle4B1" style="text-align:left;"><span class="Tabelle4B">
- <p class="TextInTable">检查变量x中是(真)否(假)包含字符串"ABC"。</p>
- </span></td></tr><tr class=""><td class="Tabelle4A2" style="text-align:left;"><span class="Tabelle4A">
- <p class="TextInTable">x == ""或x EQ ""</p>
- <p class="TextInTable">τ¡ë</p>
- <p class="TextInTable">!x或NOT x</p>
- </span></td><td class="Tabelle4B2" style="text-align:left;"><span class="Tabelle4B">
- <p class="TextInTable">检查变量x中是否包含一个空字符串。在此,这两种方法包含同一个函数。</p>
- </span></td></tr></table>
- <p class="Paragraph"/>
- <table><tr class="Tabelle21"><th class="Tabelle2A1" style="text-align:left;"><span class="Tabelle2A">
- <p class="Paragraph"><draw:image draw:style-name="fr1" draw:name="HIND_2" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="0" xlink:href="65980" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
- </span></th><th class="Tabelle2A1" style="text-align:left;"><span class="Tabelle2B">
- <p class="Paragraph">在条件中,您必须使用两个等号作为比较运算符"等于",例如x == 1。例如,如果您用数值1定义一个变量,但在输入条件时错误地写成x = 1,<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>便认为您条件有错,从而在输出结果时总是输出"假"。</p>
- </span></th></tr></table>
- <p class="Paragraph"/>
- <p class="Head3">使用者数据</p>
- <p class="Paragraph">在设置条件时,您可以根据需要读取使用者数据,这些资料便是您在<span class="T1">工具 - 选项 - <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> - 使用者数据</span>中所输入的。使用者数据总是作为字符串,您可以用"==" (EQ)或"!=" (NEQ)或"!"(NOT)查询内容。</p>
- <p class="Paragraph">使用者数据的变量名定义如下:</p>
- <table border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" page-break-inside="page-break-inside:avoid"><tr class=""><th class="Tabelle10A1" style="text-align:left;"><span class="Tabelle10A">
- <p class="TableHead">变量</p>
- </span></th><th class="Tabelle10B1" style="text-align:left;"><span class="Tabelle10B">
- <p class="TableHead">含义</p>
- </span></th></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_firstname</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">名字</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_lastname</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">姓氏</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_initials</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">缩写</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_company</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">公司</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_street</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">ΦíùΘüô</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_country</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">国家</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_zipcode</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">邮政编码</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_city</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">城市</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_title</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">标题</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_position</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">位置</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_tel_work</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">办公电话</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_tel_home</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">私人电话</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_fax</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">传真号码</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_email</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">电子信箱地址</p>
- </span></td></tr><tr class=""><td class="Tabelle10A2" style="text-align:left;"><span class="Tabelle10A">
- <p class="TextInTable">user_state</p>
- </span></td><td class="Tabelle10B2" style="text-align:left;"><span class="Tabelle10B">
- <p class="TextInTable">省市(不是所有<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>版本都有)</p>
- </span></td></tr></table>
- <p class="Paragraph">例如,为了可以在使用者数据中输入一个特定的缩写,例如 "LM",便能隐藏一个段落或一段文字或者隐入一个区域,可以输入如下条件:user_initials=="LM"。</p>
- <p class="Head2">条件和数据库字段</p>
- <p class="Paragraph">如果您使用数据库,便可以设置一些条件,令它们能读取数据库字段中的内容。这些条件可以用来检查数据库字段中是否含有内容,或者查询数据库字段中的内容。在这里,同样也是对使用比较运算符或逻辑<help:link Id="67808" Eid="operatoren" xmlns:help="http://openoffice.org/2000/help">运算符</help:link>表述的逻辑表达式进行判别。示例如下:</p>
- <table border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" page-break-inside="page-break-inside:avoid"><tr class=""><th class="Tabelle5A1" style="text-align:left;"><span class="Tabelle5A">
- <p class="TableHead">示例</p>
- </span></th><th class="Tabelle5B1" style="text-align:left;"><span class="Tabelle5B">
- <p class="TableHead">含义</p>
- </span></th></tr><tr class=""><td class="Tabelle5A2" style="text-align:left;"><span class="Tabelle5A">
- <p class="TextInTable">数据库.表格.公司</p>
- <p class="TextInTable">τ¡ë</p>
- <p class="TextInTable">数据库.表格.公司 != ""或者数据库.表格.公司NEQ ""</p>
- </span></td><td class="Tabelle5B2" style="text-align:left;"><span class="Tabelle5B">
- <p class="TextInTable">如果字段"公司"已填入内容,则输出值为真。(在第一个变量中不需要有运算符。)</p>
- </span></td></tr><tr class=""><td class="Tabelle5A2" style="text-align:left;"><span class="Tabelle5A">
- <p class="TextInTable">!数据库.表格.公司或者</p>
- <p class="TextInTable">NOT数据库.表格.公司</p>
- <p class="TextInTable">τ¡ë</p>
- <p class="TextInTable">数据库.表格.公司== ""或数据库.表格.公司EQ ""</p>
- </span></td><td class="Tabelle5B2" style="text-align:left;"><span class="Tabelle5B">
- <p class="TextInTable">如果字段"公司"空白,则输出值为真。(感叹号相当于逻辑非。)</p>
- </span></td></tr><tr class=""><td class="Tabelle5A2" style="text-align:left;"><span class="Tabelle5A">
- <p class="TextInTable">数据库.表格.公司!= "Sun Microsystems"或数据库.表格.公司NEQ "Sun Microsystems"</p>
- </span></td><td class="Tabelle5B2" style="text-align:left;"><span class="Tabelle5B">
- <p class="TextInTable">如果字段"公司"中不是"Sun Microsystems",则为真。</p>
- </span></td></tr><tr class=""><td class="Tabelle5A2" style="text-align:left;"><span class="Tabelle5A">
- <p class="TextInTable">数据库.表格.名AND数据库.表格.姓</p>
- </span></td><td class="Tabelle5B2" style="text-align:left;"><span class="Tabelle5B">
- <p class="TextInTable">如果数据条目既包含姓又包含名,则输出值为真。</p>
- </span></td></tr></table>
- <p class="Paragraph"/>
- <table><tr class="Tabelle61"><th class="Tabelle6A1" style="text-align:left;"><span class="Tabelle6A">
- <p class="Paragraph"><draw:image draw:style-name="fr1" draw:name="HIND_3" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="1" xlink:href="65980" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
- </span></th><th class="Tabelle6A1" style="text-align:left;"><span class="Tabelle6B">
- <p class="Paragraph">请注意逻辑非"!" (NOT)和比较运算符不等号"!=" (NEQ)之间的区别。</p>
- </span></th></tr></table>
- <p class="Paragraph">如您在上述示例中看到的那样,数据库字段应以"Datenbankname.Tabellenname.Feldname"的形式进行设定(没有引号)。<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>便能自动识别,一个数据库字段。如果您不希望这样,则必须将条件文字置于引号中,于是,它便被编译为"普通"文字。</p>
- <p class="Paragraph"><help:key-word value="隐入的段落; 数据库字段" tag="kw67700_8" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="空白段落; 邮件合并" tag="kw67700_7" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="邮件合并; 空白段落" tag="kw67700_6" xmlns:help="http://openoffice.org/2000/help"/><help:key-word value="字段指令; 隐入的段落, 例子" tag="kw67700_5" xmlns:help="http://openoffice.org/2000/help"/>示例:数据库字段中的隐入的段落</p>
- <p class="Paragraph">假设您在一个文档中插入了邮件合并字段"公司",您的通讯簿 - 数据源中包含的数据条目中字段"公司"是空白的,您的文档中就会生成一个空白段落。如果字段空白,则要求该段落不被显示。</p>
- <p class="Paragraph">您选择字段指令"隐入的段落"并输入以下内容作为条件:通讯簿.ADDRESS.公司EQ ""或NOT通讯簿.ADDRESS.公司。如果数据库字段"公司"空白,则条件为真,该段落被隐入并且在打印中被忽略。</p>
- <table><tr class="Tabelle71"><th class="Tabelle7A1" style="text-align:left;"><span class="Tabelle7A">
- <p class="Paragraph"><draw:image draw:style-name="fr1" draw:name="HIND_4" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="2" xlink:href="65980" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
- </span></th><th class="Tabelle7A1" style="text-align:left;"><span class="Tabelle7B">
- <p class="Paragraph">如果标记了复选框<span class="T1">工具 - 选项 - 文本文档 - 格式化辅助 - 隐入的段落</span>,则屏幕中重新显示隐入的段落。</p>
- </span></th></tr></table>
- <p class="Head2">字段指令中的条件示例</p>
- <p class="Paragraph">设置条件的各种功能对于所有用条件进行检查的字段指令效果相同。以下,以字段"有条件的文字"为例,对这些功能进行说明。条件的语法同样可以完全套用到隐入的文字、隐入的段落、任意或者下一个数据条目这些字段中。</p>
- <p class="Head3">带一个<help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname>变量的有条件的文字</p>
- <p class="Paragraph">打开一个空白文本文档,并插入一个包含下列参数,类型为有条件的文字的字段指令:</p>
- <p class="Paragraph">条件:page == 1</p>
- <p class="Paragraph">就:只有一页</p>
- <p class="Paragraph">其它:有多页</p>
- <p class="Paragraph">然后插入一个手动换页(菜单<span class="T1">插入 - 手动换行...</span>)并按下F9,以更新字段内容。</p>
- <p class="Head3">带一个自定义变量的有条件的文字</p>
- <p class="Paragraph">定义一个类型为"变量设置"的字段,名称为"盈利",值为5000,选择数字格式"货币"并将该字段指令插入到文档中。</p>
- <p class="Paragraph">现在插入一个包含以下参数、类型为有条件的文字的字段指令:</p>
- <p class="Paragraph">条件:盈利< 10000</p>
- <p class="Paragraph">就:不满足条件</p>
- <p class="Paragraph">否则:满足条件</p>
- <p class="Paragraph">双击变量字段打开用于编辑字段指令的对话框,将值由5000改为15000。如果您在对话框中用<span class="T1">确定</span>进行确认,则条件被满足。</p>
- <p class="Head3">带一个数据库字段的有条件的文字</p>
- <p class="Paragraph"><a name="tip34text"/>打开一个数据源,令数据条目显示。现在,在文档中连续插入两�鲇始喜⒆侄�名"和"姓"。</p>
- <p class="Paragraph">在数据源视图中选出一个数据条目,然后按击图标<span class="T1">字段中的数据</span>。所选中的数据条目中的字段内容便被套用到文档中。</p>
- <p class="Paragraph">现在要在姓氏和名字之间插入一个空白字符,但是只有当该数据条目包含一个名字时才插入;如果只有一个姓,则要求空白字符不显示。</p>
- <p class="Paragraph">为此,您可以将光标置于这两个字段指令之间,并插入一个包含以下参数、类型为有条件的文字的新增字段指令:</p>
- <p class="Paragraph">条件:通讯簿.地址.名字</p>
- <p class="Paragraph">就:空白字符</p>
- <p class="Paragraph">其它:(不填)</p>
- <p class="Paragraph">这样,如果在您的通讯簿中输入了名字,便插入这个空白字符。在数据源视图中选出一个没有名的数据条目,然后选择函数<span class="T1">输入数据</span>,您便能看到如何单独插入一个姓氏。</p>
- <table><tr class="Tabelle81"><th class="Tabelle8A1" style="text-align:left;"><span class="Tabelle8A">
- <p class="Paragraph"><draw:image draw:style-name="fr1" draw:name="HIND_5" text:anchor-type="paragraph" svg:width="0.847cm" svg:height="0.847cm" draw:z-index="3" xlink:href="66732" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad" xmlns:draw="http://openoffice.org/2000/drawing" xmlns:text="http://openoffice.org/2000/text" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/></p>
- </span></th><th class="Tabelle8A1" style="text-align:left;"><span class="Tabelle8B">
- <p class="Paragraph">您可以用拖放方式将引用到数据库字段中的条件套用到文本框中。</p>
- </span></th></tr></table>
- <a name="ende"/>
- <p class="Paragraph">在条件中,您不仅可以检查是否一个字段被填入内容,还可以查询内容:</p>
- <p class="Paragraph">插入一个包含以下参数的,类型为有条件的文字的字段指令:</p>
- <p class="Paragraph">条件:通讯簿.地址.名== "Michael"</p>
- <p class="Paragraph">就:亲爱的</p>
- <p class="Paragraph">其它:您好</p>
- <p class="Paragraph">您可以在字段指令后设置一个空白字符,然后将名作为邮件合并字段进行插入。</p>
- <p class="Paragraph">您可以在此找到有关<help:link Id="68207" xmlns:help="http://openoffice.org/2000/help">制作邮件合并</help:link>的说明。</p>
- </body></html>