ExcelConditionalFormattingAgentTools Class
Provides AI agent tools for Excel conditional formatting operations. Handles adding, removing, and managing conditional formatting rules in worksheets. Supports CellValue, Formula, DataBar, ColorScale, and IconSet format types.
Inheritance
Inherited Members
Namespace: Syncfusion.AI.AgentTools.Excel
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class ExcelConditionalFormattingAgentTools : AgentToolBase<IWorkbook>
Constructors
ExcelConditionalFormattingAgentTools(DocumentStorageManager)
Initializes a new instance of the ExcelConditionalFormattingAgentTools class (Mode 2 — DocumentStorage).
Declaration
public ExcelConditionalFormattingAgentTools(DocumentStorageManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| DocumentStorageManager | manager | The document storage manager. |
ExcelConditionalFormattingAgentTools(ExcelWorkbookManager)
Initializes a new instance of the ExcelConditionalFormattingAgentTools class (Mode 1 — InMemory).
Declaration
public ExcelConditionalFormattingAgentTools(ExcelWorkbookManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| ExcelWorkbookManager | manager | The Excel workbook manager. |
Methods
AddConditionalFormat(String, String, String, String, String, String, String, String, Nullable<Boolean>, Nullable<Boolean>, String)
Adds conditional formatting to a cell or range in the worksheet.
Declaration
[Tool(Name = "AddConditionalFormat", Description = "Adds conditional formatting to a cell or range based on specified criteria. workbookIdOrFilePath: The workbook ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult AddConditionalFormat([ToolParameter(Description = "The workbook ID (InMemory mode) or input file path (DocumentStorage mode)")] string workbookIdOrFilePath, [ToolParameter(Description = "The name of the worksheet")] string worksheetName, [ToolParameter(Description = "The cell or range address (e.g., A1, B5:C10)")] string rangeAddress, [ToolParameter(Description = "Format type: CellValue, Formula, DataBar, ColorScale, IconSet")] string formatType, [ToolParameter(Description = "Operator (only for CellValue format type) EXACT values only: 'Equal', 'NotEqual', 'Greater', 'Less', 'Between', 'NotBetween', 'GreaterOrEqual', 'LessOrEqual'. Use empty string or 'None' for DataBar/ColorScale/IconSet")] string operatorType = null, [ToolParameter(Description = "The first formula or value (only for CellValue/Formula). Not needed for DataBar/ColorScale/IconSet")] string firstFormula = null, [ToolParameter(Description = "Optional second formula (for Between/NotBetween)")] string secondFormula = null, [ToolParameter(Description = "Optional background color. Must be a valid ExcelKnownColors and only ExcelKnownColors enum names are accepted (e.g., Red, Yellow, Light_orange, Light_green, Blue, Green, White, Black). Do NOT use hex values (#FF0000), RGB values, or other color formats—they will fail.")] string backColor = null, [ToolParameter(Description = "Optional: Apply bold formatting")] Nullable<bool> isBold = null, [ToolParameter(Description = "Optional: Apply italic formatting")] Nullable<bool> isItalic = null, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | workbookIdOrFilePath | The workbook ID (InMemory mode) or input file path (DocumentStorage mode). |
| System.String | worksheetName | The name of the worksheet. |
| System.String | rangeAddress | The cell or range address (e.g., "A1", "B5:C10"). |
| System.String | formatType | The conditional format type: CellValue, Formula, DataBar, ColorScale, IconSet, etc. |
| System.String | operatorType | Comparison operator (only for CellValue type) EXACT enum values only: Equal, NotEqual, Greater, Less, Between, NotBetween, GreaterOrEqual, LessOrEqual. Do NOT use LessThan, GreaterThan, or variants. Not used for DataBar, ColorScale, or IconSet. |
| System.String | firstFormula | The first formula or value for comparison (only for CellValue/Formula types). Not used for DataBar, ColorScale, or IconSet. |
| System.String | secondFormula | Optional second formula (required for Between/NotBetween operators). |
| System.String | backColor | Optional background color. MUST be a name from the |
| System.Nullable<System.Boolean> | isBold | Optional: Apply bold formatting. |
| System.Nullable<System.Boolean> | isItalic | Optional: Apply italic formatting. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result indicating success or failure. |