Nota: Queremos fornecer-lhe os conteúdos de ajuda mais recentes o mais rapidamente possível e no seu idioma. Esta página foi traduzida automaticamente e pode conter erros gramaticais ou imprecisões. O nosso objetivo é que estes conteúdos lhe sejam úteis. Pode informar-nos se as informações foram úteis no final desta página? Eis o artigo em inglês para referência.
Neste artigo
What is conditional formatting?
In Microsoft Office InfoPath 2007, conditional formatting allows you to specify different formatting options for a control, based on conditions that occur on the form. If the specified conditions are true when a user fills out a form that is based on your form template, the conditional formatting is displayed. You can use conditional formatting to apply bold, underline, italic, strikethrough, font color, and background color to controls. You can also use conditional formatting to determine whether a control is visible on the form when users fill it out, whether the control is disabled, or whether to enable users to add or remove certain controls, such as optional sections.
The following includes some examples of how to use conditional formatting in a form template:
-
Hide the shipping address section unless the Specify Shipping Address check box is selected.
-
Change the font color to blue and the font style to bold for all expenses that require a receipt.
-
Change row colors in a repeating table based on the value of a text box in the row. For example, make the row for an item that is behind schedule red, and the row for an item that is on schedule green.
-
Mark financial entries with red text when they are less than $0 and green text when they are $0 or more.
-
Filter rows in a repeating table.
Nota: To display a message when a user enters incorrect values into a form, you can also use validação de dados.
Compatibility considerations
When you design a form template in InfoPath, you can choose a specific compatibility mode to design a browser-compatible form template. When a browser-compatible form template is published to a server running InfoPath Forms Services, and then browser-enabled, forms based on the form template can be viewed in a Web browser. When you design a browser-compatible form template, some controls are unavailable in the Controls task pane because they cannot be displayed in a Web browser.
List of controls that support conditional formatting
The following table lists the Office InfoPath 2007 controls that support conditional formatting, and whether they are available for browser-compatible form templates.
Controls that support conditional formatting |
Available for browser-compatible form templates? |
Botão |
Sim |
Caixa de verificação |
Sim |
Date picker |
Sim |
Caixa de lista pendente |
Sim |
Caixa de expressão |
Sim |
File attachment |
Sim |
Caixa de listagem |
Sim |
Botão de opção |
Sim |
Optional section |
Sim |
Repeating section |
Sim |
Tabela de repetição |
Sim |
Rich text box |
Sim |
Secção |
Sim |
Caixa de texto |
Sim |
Bulleted, numbered, or plain list |
Não |
Choice section |
Não |
Caixa de combinação |
Não |
Horizontal repeating table |
Não |
Ink picture |
Não |
Master/Detail |
Não |
Multiple-selection list box |
Não |
Imagem |
Não |
Repeating recursive section |
Não |
Vertical label |
Não |
Add conditional formatting
-
On the form template, select the control that you want to add conditional formatting to, and then click Conditional Formatting on the Format menu.
-
Na caixa de diálogo Formatação Condicional, clique em Adicionar.
-
In the If this condition is true boxes, enter the condition.
Nota: InfoPath verifies a condition by checking the value of the campo to which the control is bound, not the control itself.
-
To add additional conditions, click And, and then in the rightmost box under If this condition is true, do one of the following:
-
To apply the formatting only when both conditions are true, click and.
-
To apply the formatting when one or both of the conditions are true, click the arrow next to and, and then click or.
-
-
Under Then apply this formatting, select the formatting that you want to apply for your condition or conditions, and then click OK.
Nota: If more than one specified condition is true, InfoPath applies only the formatting of the first true condition.
-
Para testar as suas alterações, clique em Pré-visualizar na barra de ferramentas Padrão ou prima CTRL+SHIFT+B.
Change conditional formatting
-
On the form template, select the control whose conditional formatting you want to change, and then click Conditional Formatting on the Format menu.
-
In the Conditional Formatting dialog box, select the condition that you want to change, and then click Modify.
-
In the If this condition is true boxes, modify the condition.
Nota: InfoPath verifies a condition by checking the value of the field that is bound to the control, not the control itself.
-
Select any new formatting that you want to apply for your condition or conditions, and then click OK.
-
If you have multiple conditions for a control and want to change the order in which they are evaluated, select a condition in the Conditional Formatting dialog box, and then click Move Up or Move Down.
Nota: If more than one specified condition is true, InfoPath applies only the formatting of the first true condition.
-
Para testar as suas alterações, clique em Pré-visualizar na barra de ferramentas Padrão ou prima CTRL+SHIFT+B.