// Replace text in PPT slide private void ReplaceTextMatchingAltText(PresentationDocument presentationDocument, string relationshipId) { OpenXmlElementList slideIds = presentationDocument.PresentationPart.Presentation.SlideIdList.ChildElements; foreach (SlideId sID in slideIds) // loop thru the SlideIDList { string relId = sID.RelationshipId; // get first slide relationship if (relationshipId == relId) { SlidePart slide = (SlidePart)presentationDocument.PresentationPart.GetPartById(relId); // Get the slide part from the relationship ID. P.ShapeTree tree = slide.Slide.CommonSlideData.ShapeTree; foreach (P.Shape shape in tree.Elements <P.Shape>()) { // Run through all the paragraphs in the document foreach (A.Paragraph paragraph in shape.Descendants().OfType <A.Paragraph>()) { foreach (A.Run run in paragraph.Elements <A.Run>()) { if (run.Text.InnerText.Contains("Name")) { run.Text = new A.Text("Your new text"); } } } } } } }