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

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Creating a presentation instance
            Presentation pres = new Presentation();

            // Access the presentation slide
            ISlide slide = pres.Slides[0];

            // Add Smart Art IShape
            ISmartArt smart = slide.Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);

            // Accessing the SmartArt node at index 0
            ISmartArtNode node = smart.AllNodes[0];

            // Adding new child node at position 2 in parent node
            SmartArtNode chNode = (SmartArtNode)((SmartArtNodeCollection)node.ChildNodes).AddNodeByPosition(2);

            // Add Text
            chNode.TextFrame.Text = "Sample Text Added";

            // Save Presentation
            pres.Save(dataDir + "AddSmartArtNodeByPosition_out.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
Exemplo n.º 2
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 SmartArt)
                {
                    //Typecast shape to SmartArt
                    SmartArt smart = (SmartArt)shape;

                    //Adding a new SmartArt Node
                    SmartArtNode TemNode = (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
                    SmartArtNode newNode = (SmartArtNode)TemNode.ChildNodes.AddNode();

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

            //Saving Presentation
            pres.Save(dataDir + "AddSmartArtNode.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
        }
Exemplo n.º 3
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SmartArts();

            // Create directory if it is not already present.
            bool IsExists = System.IO.Directory.Exists(dataDir);

            if (!IsExists)
            {
                System.IO.Directory.CreateDirectory(dataDir);
            }

            // Instantiate the presentation
            Presentation pres = new Presentation();

            // Accessing the first slide
            ISlide slide = pres.Slides[0];

            // Adding the SmartArt shape in first slide
            ISmartArt smart = slide.Shapes.AddSmartArt(0, 0, 400, 400, SmartArtLayoutType.StackedList);

            // Accessing the SmartArt  node at index 0
            ISmartArtNode node = smart.AllNodes[0];

            // Accessing the child node at position 1 in parent node
            int          position = 1;
            SmartArtNode chNode   = (SmartArtNode)node.ChildNodes[position];

            // Printing the SmartArt child node parameters
            string outString = string.Format("j = {0}, Text = {1},  Level = {2}, Position = {3}", position, chNode.TextFrame.Text, chNode.Level, chNode.Position);

            Console.WriteLine(outString);
        }
        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 + "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 SmartArt)
                {

                    //Typecast shape to SmartArt
                    SmartArt smart = (SmartArt)shape;

                    //Traverse through all nodes inside SmartArt
                    for (int i = 0; i < smart.AllNodes.Count; i++)
                    {
                        //Accessing SmartArt node at index i
                        SmartArtNode node = (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);
                    }
                }
            }
            
            
        }
Exemplo n.º 5
0
        private void Pregunta35()
        {
            p1 = "INCORRECTO";
            Word.InlineShapes iShapes = docAlumno.InlineShapes;

            if (iShapes.Count == 1)
            {
                Word.InlineShape smart = iShapes[1];
                int         pagina     = smart.Range.get_Information(Word.WdInformation.wdActiveEndPageNumber); //3
                MsoTriState isSmart    = smart.HasSmartArt;                                                     //comprobar que sea smartart

                if (isSmart == MsoTriState.msoTrue && pagina == 3)
                {
                    string name        = smart.SmartArt.Layout.Name;    //"Lista con rectángulos en vertical"
                    int    numeroNodos = smart.SmartArt.AllNodes.Count; //5

                    if (numeroNodos == 5)
                    {
                        SmartArtNode nodo1  = smart.SmartArt.AllNodes[1];
                        string       texto1 = nodo1.TextFrame2.TextRange.Text; //Dolor abdominal

                        SmartArtNode nodo2  = smart.SmartArt.AllNodes[2];      //Fiebre
                        string       texto2 = nodo2.TextFrame2.TextRange.Text;

                        if (texto1.Equals("Dolor abdominal") && texto2.Equals("Fiebre"))
                        {
                            p1 = "CORRECTO";
                        }
                    }
                }
            }

            GuardarPuntaje();
            CerrarWords();

            BorrarPreguntasTemporales();
        }
Exemplo n.º 6
0
        private void Pregunta1()
        {
            bool smartEsCorrecto = false;
            /******************** Comprobar si el SmartArt es correcto ******************/
            string nameLayout = objWordAlumno.SmartArtLayouts[6].Name;

            Word.InlineShapes iShapes = docAlumno.InlineShapes;

            if (iShapes.Count == 1)
            {
                Word.InlineShape smart = iShapes[1];
                var isSmart            = smart.HasSmartArt;

                if (isSmart == MsoTriState.msoTrue) //comprobar que sea smartart
                {
                    string name        = smart.SmartArt.Layout.Name;
                    int    numeroNodos = smart.SmartArt.AllNodes.Count;

                    if (name.Equals(nameLayout) && numeroNodos == 3)
                    {
                        SmartArtNode nodo1  = smart.SmartArt.AllNodes[1];
                        string       texto1 = nodo1.TextFrame2.TextRange.Text;

                        SmartArtNode nodo2  = smart.SmartArt.AllNodes[2];
                        string       texto2 = nodo2.TextFrame2.TextRange.Text;

                        SmartArtNode nodo3  = smart.SmartArt.AllNodes[3];
                        string       texto3 = nodo3.TextFrame2.TextRange.Text;

                        if (texto1.Equals("Autosimilitud") && texto2.Equals("") && texto3.Equals(""))
                        {
                            smartEsCorrecto = true;
                        }
                    }
                }
            }
            /*********************************************************************/

            string textPdf = obtenerTextoDePdf();

            // Algoritmo recursivo (iteración) \n \nAutosimilitud\n  LOS FRACTALES
            // Algoritmo recursivo (iteración) \nAutosimilitud\n \n  LOS FRACTALES
            string cadenaAchequear1 = "Algoritmo recursivo (iteración) \n \nAutosimilitud\n  LOS FRACTALES";
            string cadenaAchequear2 = "Algoritmo recursivo (iteración) \nAutosimilitud\n \n  LOS FRACTALES";

            string contenidoDeArchivo = textPdf;

            if (smartEsCorrecto)
            {
                if (contenidoDeArchivo.Contains(cadenaAchequear1) || contenidoDeArchivo.Contains(cadenaAchequear2))
                {
                    p1 = "CORRECTO";
                }
                else
                {
                    p1 = "INCORRECTO";
                }
            }
            else
            {
                p1 = "INCORRECTO";
            }

            GuardarPuntaje();
            CerrarWords();
            BorrarPreguntasTemporales();
        }