## AddCondition(FormatConditionType, OperatorType, string, string) {#addcondition_1}

添加格式化条件。

```csharp
public int AddCondition(FormatConditionType type, OperatorType operatorType, string formula1, 
    string formula2)
```

| 范围 | 类型 | 描述 |
| --- | --- | --- |
| type | FormatConditionType | 的条件格式。 它可能是 FormatConditionType 的成员之一。 |
| operatorType | OperatorType | 比较[`OperatorType`](../../operatortype). 它可能是 OperatorType 的成员之一。 |
| formula1 | String | 与条件格式相关的值或表达式。 如果输入值以'='开头，则将其视为公式。 否则将其视为纯值（文本，数字，布尔）。 对于文本值以 '=' 开头，用户可以将其作为公式输入，格式为：“=\”=...\“”。 |
| formula2 | String | 与条件格式相关的值或表达式。 输入格式与公式1相同 |

### 返回值

格式化条件对象索引；

### 也可以看看

* enum [FormatConditionType](../../formatconditiontype)
* enum [OperatorType](../../operatortype)
* class [FormatConditionCollection](../../formatconditioncollection)
* 命名空间 [Aspose.Cells](../../formatconditioncollection)
* 部件 [Aspose.Cells](../../../)

---

## AddCondition(FormatConditionType) {#addcondition}

添加格式条件。

```csharp
public int AddCondition(FormatConditionType type)
```

| 范围 | 类型 | 描述 |
| --- | --- | --- |
| type | FormatConditionType | 格式条件类型。 |

### 返回值

格式化条件对象索引；

### 也可以看看

* enum [FormatConditionType](../../formatconditiontype)
* class [FormatConditionCollection](../../formatconditioncollection)
* 命名空间 [Aspose.Cells](../../formatconditioncollection)
* 部件 [Aspose.Cells](../../../)

<!-- DO NOT EDIT: generated by xmldocmd for Aspose.Cells.dll -->
