コード例 #1
0
        public void FormatShape(int sldNum, string shpNum, DataTable dt)
        {
            CMsoTriState pptMsoObject = new CMsoTriState();

            try
            {
                PowerPoint.Shape Activeshape = OpenedPPT.Slides[sldNum].Shapes[shpNum];
                List <int>       rgbVal      = new List <int>();
                List <int>       rgbVal1     = new List <int>();
                //if (textAdjust == false) { textAdjust = true; }
                //if (sizeAdjust == false) { sizeAdjust = true; }
                Activeshape.Name = Convert.ToString(dt.Rows[0]["Name"]);
                //-- Selected object is line --
                Activeshape.Line.Visible = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["LineVisible"])); //MsoTriState.msoTrue;                               // Apply a msoValue Condition
                Activeshape.Fill.Visible = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["FillVisible"])); //MsoTriState.msoFalse;
                if (Convert.ToInt32(dt.Rows[0]["LineVisible"]) == -1)
                {
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["LineForeColor"]));
                    Activeshape.Line.ForeColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();              // Apply a msoValue Condition
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["LineBackColor"]));
                    Activeshape.Line.BackColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();              // Apply a msoValue Condition
                    Activeshape.Line.Weight        = (float)Convert.ToDouble(dt.Rows[0]["LineWeight"]);
                    Activeshape.Line.Style         = MsoLineStyle.msoLineSingle;
                }// Apply a msoValue Condition


                if (Convert.ToInt32(dt.Rows[0]["FillVisible"]) == -1)
                {
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["FillColor"]));
                    Activeshape.Fill.ForeColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();               // Apply a msoValue Condition
                    Activeshape.Fill.Transparency  = Convert.ToInt32(dt.Rows[0]["FillTransparency"]);
                }

                //Shape Shadow
                Activeshape.Shadow.Visible = MsoTriState.msoFalse;                                // Apply a msoValue Condition
                if (Convert.ToInt32(dt.Rows[0]["ShadowVisible"]) == -1)
                {
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["LineForeColor"]));
                    Activeshape.TextFrame.TextRange.Font.Name = Convert.ToString(dt.Rows[0]["FontName"]);
                    //LineForeColor
                    Activeshape.Shadow.ForeColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();            // Apply a msoValue Condition
                    Activeshape.Shadow.Blur          = Convert.ToInt32(dt.Rows[0]["ShadowBlur"]);
                    Activeshape.Shadow.Size          = Convert.ToInt32(dt.Rows[0]["ShadowSize"]);
                    Activeshape.Shadow.Transparency  = Convert.ToInt32(dt.Rows[0]["ShadowTransparency"]);
                    Activeshape.Shadow.OffsetX       = Convert.ToInt32(dt.Rows[0]["ShadowOffsetX"]);
                    Activeshape.Shadow.OffsetY       = Convert.ToInt32(dt.Rows[0]["ShadowOffsetY"]);
                }
                Activeshape.Rotation = Convert.ToInt32(dt.Rows[0]["Rotaion"]);

                Activeshape.LockAspectRatio = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["LockAspectRatio"]));

                //Shape Position


                // -- Set a Text Frame -
                Activeshape.TextFrame.Orientation    = pptMsoObject.getOrientation(Convert.ToInt32(dt.Rows[0]["Orientation"]));
                Activeshape.TextFrame.VerticalAnchor = pptMsoObject.getVerticalAnchor(Convert.ToInt32(dt.Rows[0]["VerticalAnchor"]));
                Activeshape.TextFrame.AutoSize       = pptMsoObject.TxtAutoSize(0);                                       // Only for test -
                Activeshape.TextFrame.AutoSize       = pptMsoObject.TxtAutoSize(Convert.ToInt32(dt.Rows[0]["AutoSize"])); // Apply a msoValue Condition
                Activeshape.TextFrame.MarginLeft     = (float)Convert.ToDouble((dt.Rows[0]["MarginLeft"]));
                Activeshape.TextFrame.MarginRight    = (float)Convert.ToDouble((dt.Rows[0]["MarginRight"]));
                Activeshape.TextFrame.MarginTop      = (float)Convert.ToDouble((dt.Rows[0]["MarginTop"]));
                Activeshape.TextFrame.MarginBottom   = (float)Convert.ToDouble((dt.Rows[0]["MarginBottom"]));
                Activeshape.TextFrame.WordWrap       = MsoTriState.msoCTrue;
                if (Activeshape.Name == "Road Map")
                {
                    Activeshape.TextFrame2.TextRange.Font.Spacing = 1;
                }
                //----- Set shape text range format --

                //List<int> rgbVal = new List<int>();
                rgbVal = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["FontColor"]));
                Activeshape.TextFrame.TextRange.Font.Name      = Convert.ToString(dt.Rows[0]["FontName"]);
                Activeshape.TextFrame.TextRange.Font.Bold      = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Bold"]));                                        //MsoTriState.msoCTrue;                        // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Italic    = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Italics"]));                                     //MsoTriState.msoFalse;                       // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Underline = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Underline"]));                                   //MsoTriState.msoFalse;                    // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Size      = Convert.ToInt32(dt.Rows[0]["FontSize"]);
                Activeshape.TextFrame.TextRange.Font.Color.RGB = System.Drawing.Color.FromArgb(rgbVal[0], rgbVal[1], rgbVal[2]).ToArgb();                                 // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Shadow    = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Shadow"]));                                      //MsoTriState.msoFalse;                       // Apply a msoValue Condition

                Activeshape.TextFrame.TextRange.Paragraphs(1).ParagraphFormat.Bullet.Type = pptMsoObject.getPpBulletType(Convert.ToInt32(dt.Rows[0]["ParagraphBullet"])); // Apply a msoValue Condition(Need to Check)

                // ---- Set the ParagraphFormat --
                Activeshape.TextFrame.TextRange.ParagraphFormat.Alignment          = pptMsoObject.ParagraphFormatAlignment(Convert.ToInt32(dt.Rows[0]["ParagraphAlignment"])); //PowerPoint.PpParagraphAlignment.ppAlignRight;               // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.ParagraphFormat.HangingPunctuation = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["ParagraphHangingPunctuation"]));  // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.ParagraphFormat.SpaceBefore        = (float)Convert.ToDouble((dt.Rows[0]["ParagraphSpaceBefore"]));
                Activeshape.TextFrame.TextRange.ParagraphFormat.SpaceAfter         = (float)Convert.ToDouble((dt.Rows[0]["ParagraphSpaceAfter"]));
                Activeshape.TextFrame.TextRange.ParagraphFormat.SpaceWithin        = (float)Convert.ToDouble((dt.Rows[0]["ParagraphSpaceWithin"]));
                //Activeshape.TextFrame.Ruler.TabStops.DefaultSpacing = 45;


                Activeshape.TextFrame.Ruler.Levels[1].FirstMargin = (float)Convert.ToDouble((dt.Rows[0]["RulerLevel1FirstMargin"]));
                Activeshape.TextFrame.Ruler.Levels[1].LeftMargin  = (float)Convert.ToDouble((dt.Rows[0]["RulerLevel1LeftMargin"]));

                // -'------------------- Specific Adjustments -----------------
                Activeshape.Left   = (float)Convert.ToDouble((dt.Rows[0]["ShapeLeft"]));
                Activeshape.Top    = (float)Convert.ToDouble((dt.Rows[0]["ShapeTop"]));
                Activeshape.Width  = (float)Convert.ToDouble((dt.Rows[0]["ShapeWidth"]));
                Activeshape.Height = (float)Convert.ToDouble((dt.Rows[0]["ShapeHeight"]));


                if (Activeshape.TextFrame.TextRange.Text.PadLeft(1) == " ")
                {
                    Activeshape.TextFrame.TextRange.Text = Activeshape.TextFrame.TextRange.Text.Trim();
                }

                var txtRange  = Activeshape.TextFrame.TextRange;
                int txtLength = Activeshape.TextFrame.TextRange.Count;

                //- - IF Road Map

                if (Convert.ToString(dt.Rows[0]["Name"]) == "Road Map")
                {
                    txtRange.ChangeCase(pptMsoObject.txtChangeCase(Convert.ToInt32(dt.Rows[0]["Case"])));
                }                                                                                                                                                    // Apply a msoValue Condition
                if (Convert.ToString(dt.Rows[0]["Name"]) == "Source Box")
                {
                    Activeshape.TextFrame.Ruler.Levels[1].FirstMargin = 0;
                    Activeshape.TextFrame.Ruler.Levels[1].LeftMargin  = 0;
                    for (int x = 1; x <= txtRange.Paragraphs().Count; x++)
                    {
                        txtRange.Paragraphs(x).ParagraphFormat.HangingPunctuation = MsoTriState.msoFalse;
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "FormatShape");
            }
        }
コード例 #2
0
        public void FormatShape(int sldNum, string shpNum, DataTable dt, bool textAdjust = true, bool sizeAdjust = true)
        {
            CMsoTriState pptMsoObject = new CMsoTriState();

            try
            {
                PowerPoint.Shape Activeshape = ActivePPT.Slides[sldNum].Shapes[shpNum];
                List <int>       rgbVal      = new List <int>();
                List <int>       rgbVal1     = new List <int>();
                //if (textAdjust == false) { textAdjust = true; }
                //if (sizeAdjust == false) { sizeAdjust = true; }
                if (Convert.ToString(dt.Rows[0]["Name"]) != "Cagr Box")
                {
                    Activeshape.Name = Convert.ToString(dt.Rows[0]["Name"]);
                }
                //-- Selected object is line --
                Activeshape.Line.Visible = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["LineVisible"])); //MsoTriState.msoTrue;                               // Apply a msoValue Condition
                Activeshape.Fill.Visible = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["FillVisible"])); //MsoTriState.msoFalse;
                if (Convert.ToInt32(dt.Rows[0]["LineVisible"]) == -1)
                {
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["LineForeColor"]));
                    Activeshape.Line.ForeColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();              // Apply a msoValue Condition
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["LineBackColor"]));
                    Activeshape.Line.BackColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();              // Apply a msoValue Condition
                    Activeshape.Line.Weight        = (float)Convert.ToDouble(dt.Rows[0]["LineWeight"]);
                    Activeshape.Line.Style         = MsoLineStyle.msoLineSingle;
                    // Apply a msoValue Condition
                    //Activeshape.Line.Visible = MsoTriState.msoTrue;
                }// Apply a msoValue Condition
                 //'Shape Fill
                 //Activeshape.Fill.Visible = MsoTriState.msoCTrue;

                if (Convert.ToInt32(dt.Rows[0]["FillVisible"]) == -1)
                {
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["FillColor"]));
                    Activeshape.Fill.ForeColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();               // Apply a msoValue Condition
                    Activeshape.Fill.Transparency  = Convert.ToInt32(dt.Rows[0]["FillTransparency"]);
                }

                //Shape Shadow
                Activeshape.Shadow.Visible = MsoTriState.msoFalse;                                // Apply a msoValue Condition
                if (Convert.ToInt32(dt.Rows[0]["ShadowVisible"]) == -1)
                {
                    rgbVal1 = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["LineForeColor"]));
                    Activeshape.TextFrame.TextRange.Font.Name = Convert.ToString(dt.Rows[0]["FontName"]);
                    //LineForeColor
                    Activeshape.Shadow.ForeColor.RGB = System.Drawing.Color.FromArgb(rgbVal1[0], rgbVal1[1], rgbVal1[2]).ToArgb();            // Apply a msoValue Condition
                    Activeshape.Shadow.Blur          = Convert.ToInt32(dt.Rows[0]["ShadowBlur"]);
                    Activeshape.Shadow.Size          = Convert.ToInt32(dt.Rows[0]["ShadowSize"]);
                    Activeshape.Shadow.Transparency  = Convert.ToInt32(dt.Rows[0]["ShadowTransparency"]);
                    Activeshape.Shadow.OffsetX       = Convert.ToInt32(dt.Rows[0]["ShadowOffsetX"]);
                    Activeshape.Shadow.OffsetY       = Convert.ToInt32(dt.Rows[0]["ShadowOffsetY"]);
                }
                Activeshape.Rotation = Convert.ToInt32(dt.Rows[0]["Rotaion"]);

                Activeshape.LockAspectRatio = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["LockAspectRatio"]));

                //Shape Position


                // -- Set a Text Frame -
                Activeshape.TextFrame.Orientation    = pptMsoObject.getOrientation(Convert.ToInt32(dt.Rows[0]["Orientation"]));
                Activeshape.TextFrame.VerticalAnchor = pptMsoObject.getVerticalAnchor(Convert.ToInt32(dt.Rows[0]["VerticalAnchor"]));
                Activeshape.TextFrame.AutoSize       = pptMsoObject.TxtAutoSize(0);                                       // Only for test -
                Activeshape.TextFrame.AutoSize       = pptMsoObject.TxtAutoSize(Convert.ToInt32(dt.Rows[0]["AutoSize"])); // Apply a msoValue Condition
                Activeshape.TextFrame.MarginLeft     = (float)Convert.ToDouble((dt.Rows[0]["MarginLeft"]));
                Activeshape.TextFrame.MarginRight    = (float)Convert.ToDouble((dt.Rows[0]["MarginRight"]));
                Activeshape.TextFrame.MarginTop      = (float)Convert.ToDouble((dt.Rows[0]["MarginTop"]));
                Activeshape.TextFrame.MarginBottom   = (float)Convert.ToDouble((dt.Rows[0]["MarginBottom"]));
                Activeshape.TextFrame.WordWrap       = MsoTriState.msoCTrue;
                if (Activeshape.Name == "Road Map")
                {
                    Activeshape.TextFrame2.TextRange.Font.Spacing = 1;
                }
                //----- Set shape text range format --
                if (textAdjust == true)
                {
                    if (Activeshape.Name == "Note Box" || Activeshape.Name == "Text Box")
                    {
                        string   defaultText = Convert.ToString(dt.Rows[0]["DefaultText"]).Replace("\n", "");
                        string[] text        = defaultText.Split(splitChar).ToArray();
                        if (Activeshape.Name == "Note Box")
                        {
                            Activeshape.TextFrame.TextRange.Text = text[0] + '\n' + text[1];
                        }
                        else if (Activeshape.Name == "Text Box")
                        {
                            Activeshape.TextFrame2.TextRange.Text = text[0] + "\r\n" + text[1] + "\r\n" + text[2] + "\r\n" + text[3];
                            //Activeshape.TextFrame.TextRange.Text = text[0] + '\n' + text[1] + '\n' + text[2] + '\n' + text[3];
                        }
                    }
                    else
                    {
                        Activeshape.TextFrame.TextRange.Text = Convert.ToString(dt.Rows[0]["DefaultText"]);
                    }
                }
                //List<int> rgbVal = new List<int>();
                rgbVal = pptMsoObject.get_RGBValue(Convert.ToString(dt.Rows[0]["FontColor"]));
                Activeshape.TextFrame.TextRange.Font.Name      = Convert.ToString(dt.Rows[0]["FontName"]);
                Activeshape.TextFrame.TextRange.Font.Bold      = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Bold"]));        //MsoTriState.msoCTrue;                        // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Italic    = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Italics"]));     //MsoTriState.msoFalse;                       // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Underline = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Underline"]));   //MsoTriState.msoFalse;                    // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Size      = Convert.ToInt32(dt.Rows[0]["FontSize"]);
                Activeshape.TextFrame.TextRange.Font.Color.RGB = System.Drawing.Color.FromArgb(rgbVal[0], rgbVal[1], rgbVal[2]).ToArgb(); // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.Font.Shadow    = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["Shadow"]));      //MsoTriState.msoFalse;                       // Apply a msoValue Condition

                //Activeshape.TextFrame.TextRange.Paragraphs(1).ParagraphFormat.Bullet.Type = pptMsoObject.getPpBulletType(Convert.ToInt32(dt.Rows[0]["ParagraphBullet"]));  // Apply a msoValue Condition(Need to Check)

                // ---- Set the ParagraphFormat --
                Activeshape.TextFrame.TextRange.ParagraphFormat.Alignment          = pptMsoObject.ParagraphFormatAlignment(Convert.ToInt32(dt.Rows[0]["ParagraphAlignment"])); //PowerPoint.PpParagraphAlignment.ppAlignRight;               // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.ParagraphFormat.HangingPunctuation = pptMsoObject.getMsoTriState(Convert.ToInt32(dt.Rows[0]["ParagraphHangingPunctuation"]));  // Apply a msoValue Condition
                Activeshape.TextFrame.TextRange.ParagraphFormat.SpaceBefore        = (float)Convert.ToDouble((dt.Rows[0]["ParagraphSpaceBefore"]));
                Activeshape.TextFrame.TextRange.ParagraphFormat.SpaceAfter         = (float)Convert.ToDouble((dt.Rows[0]["ParagraphSpaceAfter"]));
                Activeshape.TextFrame.TextRange.ParagraphFormat.SpaceWithin        = (float)Convert.ToDouble((dt.Rows[0]["ParagraphSpaceWithin"]));
                //Activeshape.TextFrame.Ruler.TabStops.DefaultSpacing = 45;


                Activeshape.TextFrame.Ruler.Levels[1].FirstMargin = (float)Convert.ToDouble((dt.Rows[0]["RulerLevel1FirstMargin"]));
                Activeshape.TextFrame.Ruler.Levels[1].LeftMargin  = (float)Convert.ToDouble((dt.Rows[0]["RulerLevel1LeftMargin"]));

                // -'------------------- Specific Adjustments -----------------
                if (sizeAdjust == true)
                {
                    Activeshape.Left   = (float)Convert.ToDouble((dt.Rows[0]["ShapeLeft"]));
                    Activeshape.Top    = (float)Convert.ToDouble((dt.Rows[0]["ShapeTop"]));
                    Activeshape.Width  = (float)Convert.ToDouble((dt.Rows[0]["ShapeWidth"]));
                    Activeshape.Height = (float)Convert.ToDouble((dt.Rows[0]["ShapeHeight"]));
                }



                if (Activeshape.TextFrame.TextRange.Text.PadLeft(1) == " ")
                {
                    Activeshape.TextFrame.TextRange.Text = Activeshape.TextFrame.TextRange.Text.Trim();
                }

                var txtRange  = Activeshape.TextFrame.TextRange;
                int txtLength = Activeshape.TextFrame.TextRange.Count;
                //                                                      Check it why we do the comment -
                //byte result = Convert.ToByte(txtRange.Characters(1,1));
                //if(result==9 || result==10||result==11 || result==13|| result == 32) { txtRange.Text = txtRange.Text.PadRight(txtRange.Text.Length - 1); }
                //- - IF note box

                if (Convert.ToString(dt.Rows[0]["Name"]) == "Note Box")
                {
                    Activeshape.TextFrame.Ruler.Levels[1].FirstMargin = 0;
                    Activeshape.TextFrame.Ruler.Levels[1].LeftMargin  = 0;
                    for (int x = 1; x <= txtRange.Paragraphs().Count; x++)
                    {
                        txtRange.Paragraphs(x).ParagraphFormat.HangingPunctuation = MsoTriState.msoFalse;
                    }
                    //int txtLen = Convert.ToString(dt.Rows[0]["DefaultText"]).Length;
                    //if (txtRange.Text.PadLeft(txtLen) != Convert.ToString(dt.Rows[0]["DefaultText"]))
                    //{
                    //    if (txtRange.Text.PadLeft(6) == "Notes:") { txtRange.Text = txtRange.Text.Substring(7, txtRange.Text.Length); }
                    //    else if (txtRange.Text.PadLeft(5) == "Notes:") { txtRange.Text = txtRange.Text.Substring(6, txtRange.Text.Length); }
                    //    txtRange.Text = Convert.ToString(dt.Rows[0]["DefaultText"]) + txtRange.Text;
                    //}
                }
                //- - IF Source Box
                if (Convert.ToString(dt.Rows[0]["Name"]) == "Source Box")
                {
                    Activeshape.TextFrame.Ruler.Levels[1].FirstMargin = 0;
                    Activeshape.TextFrame.Ruler.Levels[1].LeftMargin  = 0;
                    for (int x = 1; x <= txtRange.Paragraphs().Count; x++)
                    {
                        txtRange.Paragraphs(x).ParagraphFormat.HangingPunctuation = MsoTriState.msoFalse;
                    }
                    //int txtLen = Convert.ToString(dt.Rows[0]["DefaultText"]).Length;
                    //if (txtRange.Text.PadLeft(txtLen) != Convert.ToString(dt.Rows[0]["DefaultText"]))
                    //{
                    //    if (txtRange.Text.Substring(0,8) == "Sources:") { txtRange.Text = txtRange.Text.Substring(9, txtRange.Text.Length); }
                    //    else if (txtRange.Text.PadLeft(5) == "Sources:") { txtRange.Text = txtRange.Text.Substring(8, txtRange.Text.Length); }
                    //    txtRange.Text = Convert.ToString(dt.Rows[0]["DefaultText"]) + txtRange.Text;
                    //}
                }
                //- - IF Road Map

                if (Convert.ToString(dt.Rows[0]["Name"]) == "Road Map")
                {
                    txtRange.ChangeCase(pptMsoObject.txtChangeCase(Convert.ToInt32(dt.Rows[0]["Case"])));
                }                                                                                                                                                    // Apply a msoValue Condition


                // --"Quote Box"
                int sn = 0, en = 0;
                if (Convert.ToString(dt.Rows[0]["Name"]) == "Quote Box")
                {
                    var rngs = txtRange.Find("–", 0, MsoTriState.msoCTrue, MsoTriState.msoFalse);
                    var rngE = txtRange.Find(")", 0, MsoTriState.msoCTrue, MsoTriState.msoFalse);
                    if (rngs != null)
                    {
                        sn = rngs.Start;
                    }
                    if (rngE != null)
                    {
                        en = rngE.Start + 3;
                    }
                    if (rngE != null && rngs != null)
                    {
                        txtRange.Characters(sn, en).Font.Italic = MsoTriState.msoCTrue;
                        txtRange.Characters(sn, en).Font.Italic = MsoTriState.msoFalse;
                        txtRange.Characters(sn, en).Font.Bold   = MsoTriState.msoCTrue;
                    }
                }
            }
            catch (Exception err)
            {
                string errtext = err.Message;
                PPTAttribute.ErrorLog(errtext, "FormatShape");
            }
        }