public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SmartArts();

            // Load the desired the presentation
            Presentation pres = new Presentation(dataDir + "RemoveNodeSpecificPosition.pptx");

            // Traverse through every shape inside first slide
            foreach (IShape shape in pres.Slides[0].Shapes)
            {
                // Check if shape is of SmartArt type
                if (shape is Aspose.Slides.SmartArt.SmartArt)
                {
                    // Typecast shape to SmartArt
                    Aspose.Slides.SmartArt.SmartArt smart = (Aspose.Slides.SmartArt.SmartArt)shape;

                    if (smart.AllNodes.Count > 0)
                    {
                        // Accessing SmartArt node at index 0
                        Aspose.Slides.SmartArt.ISmartArtNode node = smart.AllNodes[0];

                        if (node.ChildNodes.Count >= 2)
                        {
                            // Removing the child node at position 1
                            ((Aspose.Slides.SmartArt.SmartArtNodeCollection)node.ChildNodes).RemoveNode(1);
                        }
                    }
                }
            }

            // Save Presentation
            pres.Save(dataDir + "RemoveSmartArtNodeByPosition_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
Example #2
0
        public static void Run()
        {
            // ExStart:AccessSmartArt
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SmartArts();

            // Load the desired the presentation
            Presentation pres = new Presentation(dataDir + "AccessSmartArt.pptx");

            // Traverse through every shape inside first slide
            foreach (IShape shape in pres.Slides[0].Shapes)
            {
                // Check if shape is of SmartArt type
                if (shape is Aspose.Slides.SmartArt.SmartArt)
                {
                    // Typecast shape to SmartArt
                    Aspose.Slides.SmartArt.SmartArt smart = (Aspose.Slides.SmartArt.SmartArt)shape;

                    // Traverse through all nodes inside SmartArt
                    for (int i = 0; i < smart.AllNodes.Count; i++)
                    {
                        // Accessing SmartArt node at index i
                        Aspose.Slides.SmartArt.SmartArtNode node = (Aspose.Slides.SmartArt.SmartArtNode)smart.AllNodes[i];

                        // Printing the SmartArt node parameters
                        string outString = string.Format("i = {0}, Text = {1},  Level = {2}, Position = {3}", i, node.TextFrame.Text, node.Level, node.Position);
                        Console.WriteLine(outString);
                    }
                }
            }
            // ExEnd:AccessSmartArt
        }
Example #3
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SmartArts();

            // Load the desired the presentation// Load the desired the presentation
            Presentation pres = new Presentation(dataDir + "AddNodes.pptx");

            // Traverse through every shape inside first slide
            foreach (IShape shape in pres.Slides[0].Shapes)
            {
                // Check if shape is of SmartArt type
                if (shape is Aspose.Slides.SmartArt.SmartArt)
                {
                    // Typecast shape to SmartArt
                    Aspose.Slides.SmartArt.SmartArt smart = (Aspose.Slides.SmartArt.SmartArt)shape;

                    // Adding a new SmartArt Node
                    Aspose.Slides.SmartArt.SmartArtNode TemNode = (Aspose.Slides.SmartArt.SmartArtNode)smart.AllNodes.AddNode();

                    // Adding text
                    TemNode.TextFrame.Text = "Test";

                    // Adding new child node in parent node. It  will be added in the end of collection
                    Aspose.Slides.SmartArt.SmartArtNode newNode = (Aspose.Slides.SmartArt.SmartArtNode)TemNode.ChildNodes.AddNode();

                    // Adding text
                    newNode.TextFrame.Text = "New Node Added";
                }
            }

            // Saving Presentation
            pres.Save(dataDir + "AddSmartArtNode_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }