PresentationFindAndReplaceAgentTools Class
Provides AI agent tools for PowerPoint presentation find and replace operations. Uses the Syncfusion Presentation library's built-in FindAll API for reliable text searching and replacement across all slide elements.
Inheritance
Inherited Members
Namespace: Syncfusion.AI.AgentTools.PowerPoint
Assembly: Syncfusion.DocumentSDK.AI.AgentTools.dll
Syntax
public class PresentationFindAndReplaceAgentTools : AgentToolBase<IPresentation>
Constructors
PresentationFindAndReplaceAgentTools(DocumentStorageManager)
Initializes a new instance of the PresentationFindAndReplaceAgentTools class (Mode 2 — DocumentStorage).
Declaration
public PresentationFindAndReplaceAgentTools(DocumentStorageManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| DocumentStorageManager | manager | The document storage manager. |
PresentationFindAndReplaceAgentTools(PresentationManager)
Initializes a new instance of the PresentationFindAndReplaceAgentTools class (Mode 1 — InMemory).
Declaration
public PresentationFindAndReplaceAgentTools(PresentationManager manager)
Parameters
| Type | Name | Description |
|---|---|---|
| PresentationManager | manager | The presentation manager for managing PowerPoint presentations. |
Methods
FindAndReplace(String, String[], String[], Boolean, Boolean, String)
Finds all occurrences of one or more specified texts in the presentation and replaces each with the corresponding replacement text in a single pass.
Declaration
[Tool(Name = "FindAndReplace", Description = "Finds all occurrences of one or more specified texts in the PowerPoint presentation and replaces each with the corresponding replacement text in a single pass on the same document. Accepts arrays so multiple placeholders can be replaced at once without reopening the file. Searches across all slides and elements such as shapes, textboxes, tables, SmartArt, etc. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult FindAndReplace([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "Array of texts to find ")] string[] findTexts, [ToolParameter(Description = "Array of replacement texts corresponding to each find text")] string[] replaceTexts, [ToolParameter(Description = "Whether to match case")] bool matchCase = false, [ToolParameter(Description = "Whether to match whole words only")] bool wholeWord = false, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | The ID of the presentation or input file path. |
| System.String[] | findTexts | The array of texts to find. |
| System.String[] | replaceTexts | The array of replacement texts corresponding to each find text. |
| System.Boolean | matchCase | Whether to match case. |
| System.Boolean | wholeWord | Whether to match whole words only. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the count of replaced occurrences per find text. |
FindAndReplaceByPattern(String, String, String, String)
Finds all occurrences of text matching the specified regex pattern in the presentation and replaces them with the given replacement text.
Declaration
[Tool(Name = "FindAndReplaceByPattern", Description = "Finds all occurrences of text matching the specified regex pattern in the PowerPoint presentation and replaces them with the given replacement text. Searches across all slides and elements such as shapes, textboxes, tables, SmartArt, etc. documentIdOrFilePath: The document ID (InMemory mode) or input file path (DocumentStorage mode).")]
public AgentToolResult FindAndReplaceByPattern([ToolParameter(Description = "The document ID (InMemory mode) or input file path (DocumentStorage mode)")] string documentIdOrFilePath, [ToolParameter(Description = "The regex pattern to match text (e.g., '{[A-Za-z]+}' to match placeholders like {Name}, {Date})")] string regexPattern, [ToolParameter(Description = "The replacement text")] string replaceText, [ToolParameter(Description = "Output file path for saving the result (DocumentStorage mode only).")] string outputFilePath = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | documentIdOrFilePath | |
| System.String | regexPattern | The regex pattern to match text. |
| System.String | replaceText | The replacement text. |
| System.String | outputFilePath | Output file path for saving the result (DocumentStorage mode only). |
Returns
| Type | Description |
|---|---|
| AgentToolResult | Result containing the count of replaced occurrences. |