private void btnRun_Click(object sender, EventArgs e) { //create PPT document Presentation presentation = new Presentation(); //load the document from disk presentation.LoadFromFile(@"..\..\..\..\..\..\Data\SmartArt.pptx"); //get the SmartArt and collect nodes ISmartArt sa = presentation.Slides[0].Shapes[0] as ISmartArt; ISmartArtNodeCollection nodes = sa.Nodes; //remove the node to specific position nodes.RemoveNodeByPosition(2); presentation.SaveToFile("RemoveNodes.pptx", FileFormat.Pptx2010); System.Diagnostics.Process.Start("RemoveNodes.pptx"); }
public static void Run() { // ExStart:GetTextFromSmartArtNode // The path to the documents directory. string dataDir = RunExamples.GetDataDir_Text(); using (Presentation presentation = new Presentation("Presentation.pptx")) { ISlide slide = presentation.Slides[0]; ISmartArt smartArt = (ISmartArt)slide.Shapes[0]; ISmartArtNodeCollection smartArtNodes = smartArt.AllNodes; foreach (ISmartArtNode smartArtNode in smartArtNodes) { foreach (ISmartArtShape nodeShape in smartArtNode.Shapes) { if (nodeShape.TextFrame != null) { Console.WriteLine(nodeShape.TextFrame.Text); } } } } }