Exemple #1
0
        private string GetDescrForEachPoint(PowerPoint.Shape smartArt)
        {
            /*
             * Creat the description for each node
             * 1. get node level
             * 2. has Text?
             * 3. get node content
             * 4. get node color
             */
            //TODO: Verbesserung: Bilder behandeln
            System.Diagnostics.Debug.WriteLine(SInter.GetSubCategory());
            int    pointNr     = 0;
            string description = "";

            Office.SmartArtNodes allNodes = smartArt.SmartArt.AllNodes;
            foreach (Office.SmartArtNode node in allNodes)
            {
                string text = "";
                if (node.Level == 1)
                {
                    //MainPoint
                    pointNr++;
                    if (node.TextFrame2.HasText == Office.MsoTriState.msoTrue)
                    {
                        text = GetMainPointDesc();
                        text = text.Replace("#wievielterHP#", pointNr.ToString());
                        System.Diagnostics.Debug.WriteLine(node.TextFrame2.TextRange.Text);
                        //TODO: Farben herausfinden
                        text = GetColorStyleOfNode(node, text);

                        text = text.Replace("#InhaltHauptpunkt#", node.TextFrame2.TextRange.Text);
                    }
                    else
                    {
                        text = "Hauptpunkt" + pointNr + "HAT KEINEN TEXT.";
                    }
                }
                else
                {
                    //SubPoint
                    if (node.TextFrame2.HasText == Office.MsoTriState.msoTrue)
                    {
                        text = GetSubPointDesc();
                        text = text.Replace("#Level#", node.Level.ToString());
                        text = text.Replace("#InhaltUnterpunkt#", node.TextFrame2.TextRange.Text);
                        if (text.IndexOf("#Farbe#") > 0)
                        {
                            text = GetColorStyleOfNode(node, text);
                        }
                    }
                }
                text         = System.Text.RegularExpressions.Regex.Replace(text, "\r\n", "");
                description += text + "\n";
            }
            return(description);
        }
        private string GetListfromNodes(PowerPoint.Shape smartArtShape)
        {
            /*
             * creat a list of the content from the nodes with the MDFormConverter
             * set the "existingSubPoint"
             * set the "mainPoints"
             */
            string          list       = "";
            int             mainPoints = 0;
            int             subPoints  = 0;
            MDFormConverter mdForm     = new MDFormConverter();

            Office.SmartArtNodes allNodes = smartArtShape.SmartArt.AllNodes;

            foreach (Office.SmartArtNode node in allNodes)
            {
                if (node.Hidden != Office.MsoTriState.msoTrue)
                {
                    if (node.Level > 1)
                    {
                        SetExistingSubPoints(true);
                        subPoints++;
                        // get the space before each point
                        list += mdForm.GetSpaceBefore(node.Level);
                    }
                    else
                    {
                        mainPoints++;
                        subPoints = 0;
                    }
                    // get the bullet type
                    switch (SInter.GetCategory())
                    {
                    case "process":
                        if (subPoints != 0)
                        {
                            list += mdForm.GetOrderdList(subPoints);
                        }
                        else
                        {
                            list += mdForm.GetOrderdList(mainPoints);
                        }
                        break;

                    default:
                        list += mdForm.GetLineList();
                        break;
                    }
                    // get the content
                    SInter.SetCountMainPoints(mainPoints);
                    list += node.TextFrame2.TextRange.Text + "\n";
                }
            }
            return(list);
        }
        private string GetDescrForEachPoint(PowerPoint.Shape smartArt)
        {
            /*
             * Creat the description for each node
             * 1. get node level
             * 2. has Text?
             * 3. get node content
             * 4. get node color
             */
            //TODO: Bilder behandeln
            int    subPointNr  = 0;
            int    mainPointNr = 0;
            string description = "";

            Office.SmartArtNodes allNodes = smartArt.SmartArt.AllNodes;
            foreach (Office.SmartArtNode node in allNodes)
            {
                string text = "";
                switch (node.Level)
                {
                case 1:
                    //MainPoint
                    if (node.TextFrame2.HasText == Office.MsoTriState.msoTrue)
                    {
                        mainPointNr++;
                        text = GetMainPointDesc();
                        text = text.Replace("#InhaltHauptpunkt#", node.TextFrame2.TextRange.Text);
                        if (text.Contains("#XYposition#") && SInter.GetCountMainPoints() == 4)
                        {
                            switch (mainPointNr)
                            {
                            case 1:
                                text = text.Replace("#XYposition#", "oben links");
                                break;

                            case 2:
                                text = text.Replace("#XYposition#", "oben rechts");
                                break;

                            case 3:
                                text = text.Replace("#XYposition#", "unten links");
                                break;

                            case 4:
                                text = text.Replace("#XYposition#", "unten links");
                                break;
                            }
                        }
                        // #Farbe# ----
                        text = GetColorStyleOfNode(node, text);
                    }
                    break;

                case 2:
                    if (node.TextFrame2.HasText == Office.MsoTriState.msoTrue)
                    {
                        subPointNr++;
                        text = GetSubPointDesc();
                        text = text.Replace("#Level#", "2");
                        if (text.Contains("#XYposition#") && SInter.GetCountMainPoints() == 1)
                        {
                            //switch to get the right position
                            switch (subPointNr)
                            {
                            case 1:
                                text = text.Replace("#XYposition#", "oben links");
                                break;

                            case 2:
                                text = text.Replace("#XYposition#", "oben rechts");
                                break;

                            case 3:
                                text = text.Replace("#XYposition#", "unten links");
                                break;

                            case 4:
                                text = text.Replace("#XYposition#", "unten links");
                                break;
                            }
                        }
                        text = text.Replace("#InhaltUnterpunkt#", node.TextFrame2.TextRange.Text);
                    }
                    break;

                default:
                    text = GetSubPointDesc();
                    text = text.Replace("#Level#", node.Level.ToString());
                    text = text.Replace("#XYposition#", "");
                    text = text.Replace("#InhaltUnterpunkt#", node.TextFrame2.TextRange.Text);
                    break;
                }
                text         = System.Text.RegularExpressions.Regex.Replace(text, "\r\n", "");
                description += text + "\n";
            }
            return(description);
        }
Exemple #4
0
        private string GetDescrForEachPoint(PowerPoint.Shape smartArt)
        {
            /*
             * Creat the description for each node
             * 1. get node level
             * 2. has Text?
             * 3. get node content
             * 4. get node color
             */
            //TODO: Bilder behandeln
            int    mainPointNr = 0;
            string description = "";

            Office.SmartArtNodes allNodes = smartArt.SmartArt.AllNodes;
            foreach (Office.SmartArtNode node in allNodes)
            {
                string text = "";

                if (node.Level == 1)
                {
                    //MainPoint
                    //Placeholder: #wievielterLevel1Punkt#, #InhaltHauptpunkt#
                    mainPointNr++;
                    if (node.TextFrame2.HasText == Office.MsoTriState.msoTrue)
                    {
                        text = GetMainPointDesc();


                        // #wievielterLevel1Punkt# ---
                        if (SInter.GetCountMainPoints() > 1)
                        {
                            text = text.Replace("#wievielterHP#", mainPointNr.ToString());
                        }
                        else
                        {
                            text = text.Replace("#wievielterHP#", mainPointNr.ToString());
                        }

                        // #InhaltHauptpunkt# ---
                        text = text.Replace("#InhaltHauptpunkt#", node.TextFrame2.TextRange.Text);
                        //text = text.Replace("#InhaltHauptpunkt#", GetStylesFromWord(node.TextFrame2.TextRange));

                        // #Farbe# ----
                        text = GetColorStyleOfNode(node, text);
                    }
                    else
                    {
                        text = "Hauptpunkt" + mainPointNr + "HAT KEINEN TEXT.";
                    }
                }
                else
                {
                    //SubPoint
                    //Placeholder: #LevelNummer#, #InhaltUnterpunkt#, #Leveldarueber#
                    if (node.TextFrame2.HasText == Office.MsoTriState.msoTrue)
                    {
                        text = GetSubPointDesc();
                        // #LevelNummer# ---
                        text = text.Replace("#Level#", node.Level.ToString());
                        // #InhaltUnterpunkt# ---
                        text = text.Replace("#InhaltUnterpunkt#", node.TextFrame2.TextRange.Text);
                        //text = text.Replace("#InhaltUnterpunkt#", GetStylesFromWord(node.TextFrame2.TextRange));
                        // #Leveldarueber# ---
                        text = text.Replace("#Leveldarueber#", (node.Level - 1).ToString());

                        // #Farbe# ----
                        text = GetColorStyleOfNode(node, text);
                    }
                    else
                    {
                        text = "Unterpunkt: HAT KEINEN TEXT.";
                    }
                }
                text         = System.Text.RegularExpressions.Regex.Replace(text, "\r\n", "");
                description += text + "\n";
            }
            return(description);
        }