Aspose.Slides.Examples.CSharp.SmartArts.ChangeSmartArtShapeColorStyle.Run C# (CSharp) Method

Run() public static method

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

            using (Presentation presentation = new Presentation(dataDir + "AccessSmartArtShape.pptx"))
            {
                // Traverse through every shape inside first slide
                foreach (IShape shape in presentation.Slides[0].Shapes)
                {
                    // Check if shape is of SmartArt type
                    if (shape is ISmartArt)
                    {
                        // Typecast shape to SmartArtEx
                        ISmartArt smart = (ISmartArt)shape;

                        // Checking SmartArt color type
                        if (smart.ColorStyle == SmartArtColorType.ColoredFillAccent1)
                        {
                            // Changing SmartArt color type
                            smart.ColorStyle = SmartArtColorType.ColorfulAccentColors;
                        }
                    }
                }

                // ExEnd:ChangeSmartArtShapeColorStyle
                // Saving Presentation
                presentation.Save(dataDir + "ChangeSmartArtColorStyle_out.pptx", SaveFormat.Pptx);
            }
        }
    }
ChangeSmartArtShapeColorStyle