The Syncfusion .NET PowerPoint Library allows you to find and replace text in a PowerPoint with other text in all PowerPoint slides and elements, such as shapes, text boxes, tables, and SmartArt. It provides options to find text by matching case and whole words.
Here is an example of how to find and replace text in a PowerPoint using C# using the Syncfusion .NET PowerPoint Library.
//Open an existing presentation.
using FileStream inputStream = new FileStream("Template.pptx", FileMode.Open);
using IPresentation pptxDoc = Presentation.Open(inputStream);
//Find all the occurrences of particular text in the PowerPoint presentation.
ITextSelection[] textSelections = pptxDoc.FindAll("product", false, false);
foreach (ITextSelection textSelection in textSelections)
{
//Get the found text as a single text part.
ITextPart textPart = textSelection.GetAsOneTextPart();
//Replace the text.
textPart.Text = "Service";
}
//Save the presentation.
using FileStream outputStream = new FileStream("Sample.pptx", FileMode.Create);
pptxDoc.Save(outputStream);
Find the text in a presentation based on a specific pattern using a regular expression (regex) or normal string. Find it in the entire presentation or within a specific slide.
Refine the find operation by matching the casing or whole word for more precise results.
Find only the first occurrence of a piece of text in the presentation.
Find all the occurrences of the given text in all parts of the presentation, including the shapes, text boxes, tables, and SmartArt.
Greatness—it’s one thing to say you have it, but it means more when others recognize it. Syncfusion is proud to hold the following industry awards.