I have attached a ppt.
I have a top shape with Alternate Text as "ReportHeaderLine2"
Currently the text is Active NPS Scorecard – Q1 2012…
How do i change this by code?
I want to access the shape using alternate text and then change the text…
I have attached a ppt.
Hi Pankaj,
public static ShapeEx FindShape(SlideEx slide, string alttext){//Iterating through all shapes inside the slidefor (int i = 0; i < slide.Shapes.Count; i++){//If the alternative text of the slide matches with the required one then//return the shapeif (slide.Shapes[i].AlternativeText.CompareTo(alttext) == 0)return slide.Shapes[i];}return null;}public static void ChangeText(){PresentationEx pres = new PresentationEx(“D:\Aspose Data\Pankaj.pptx”);ShapeEx shape = FindShape(pres.Slides[0], “ReportHeaderLine2”);if (shape is AutoShapeEx){AutoShapeEx ashp = (AutoShapeEx)shape;TextFrameEx txtFrm = ashp.TextFrame;if (txtFrm != null && txtFrm.Text != “”){ParagraphEx para = txtFrm.Paragraphs[0];PortionEx portion = para.Portions[0];portion.Text = “New Text Added”;}}pres.Write(“D:\Aspose Data\Pankaj2.pptx”);}
Hi Mudasir,<br><br>I set AltText for shap or place holder, but I still can't get the value, Alternativetext I got always empty. Could you send me the template working with your example code for me can try?<br><br>I need the solution can detect object uniquely. I'm thinking of defining AltText for them. I hope it will work.<br><br>Thank you,<br>GN<br><br><br>
Hi GN,