Exemplo n.º 1
0
 public PowerPoint.PpAutoSize TxtAutoSize(int dbVal)
 {
     try
     {
         if (dbVal == -2)
         {
             objValue2 = PowerPoint.PpAutoSize.ppAutoSizeMixed;
         }
         else if (dbVal == 0)
         {
             objValue2 = PowerPoint.PpAutoSize.ppAutoSizeNone;
         }
         else if (dbVal == 1)
         {
             objValue2 = PowerPoint.PpAutoSize.ppAutoSizeShapeToFitText;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "TxtAutoSize");
     }
     return(objValue2);
 }
Exemplo n.º 2
0
        public void tsc_loadtheme()
        {
            System.Text.StringBuilder specification = new System.Text.StringBuilder();
            PowerPoint.Shape          selShape      = ppApp.ActiveWindow.Selection.ShapeRange[1];


            MsoShapeType shpType = selShape.Type;

            if (selShape.Type == MsoShapeType.msoTable)
            {
                float borderWidth = selShape.Table.Rows[1].Cells[1].Borders[PowerPoint.PpBorderType.ppBorderRight].Weight;
            }
            else
            {
                foreach (PowerPoint.Shape shp in ppApp.ActiveWindow.Selection.ShapeRange)
                {
                    MsoTriState vstatus    = shp.Line.Visible;                                                     //LineVisible
                    MsoTriState fillStatus = shp.Fill.Visible;                                                     //FillVisible
                                                                                                                   //str fillColor = shp.Fill.ForeColor.RGB;               //FillColor-----------------------Not
                    float       fillTrasn = shp.Fill.Transparency;                                                 //FillTransparency
                    MsoTriState sVisible  = shp.Shadow.Visible;                                                    //ShadowVisible
                    float       sleft     = shp.Left;                                                              //ShapeLeft
                    float       stop      = shp.Top;                                                               //ShapeTop
                    float       swidth    = shp.Width;                                                             //ShapeWidth
                    float       shpHeight = shp.Height;                                                            //ShapeHeight
                    float       rot       = shp.Rotation;                                                          //Rotaion
                    MsoTriState lrvalue   = shp.LockAspectRatio;                                                   //LockAspectRatio

                    MsoTextOrientation    txtOrientation = shp.TextFrame.Orientation;                              //Orientation
                    MsoVerticalAnchor     txtAnchor      = shp.TextFrame.VerticalAnchor;                           //VerticalAnchor
                    PowerPoint.PpAutoSize autosize       = shp.TextFrame.AutoSize;                                 //AutoSize
                    float       mgleft      = shp.TextFrame.MarginLeft;                                            //MarginLeft
                    float       mgRight     = shp.TextFrame.MarginLeft;                                            //MarginRight
                    float       mgtop       = shp.TextFrame.MarginTop;                                             //MarginTop
                    float       mgbottom    = shp.TextFrame.MarginBottom;                                          //MarginBottom
                    MsoTriState wWrap       = shp.TextFrame.WordWrap;                                              //WordWrap
                    string      dtext       = shp.TextFrame.TextRange.Text;                                        //DefaultText
                    string      fname       = shp.TextFrame.TextRange.Font.Name;                                   //FontName
                    MsoTriState txbold      = shp.TextFrame.TextRange.Font.Bold;                                   //Bold
                    MsoTriState txItalics   = shp.TextFrame.TextRange.Font.Italic;                                 //Italics
                    MsoTriState txUnderline = shp.TextFrame.TextRange.Font.Underline;                              //Underline
                    float       txsize      = shp.TextFrame.TextRange.Font.Size;                                   //FontSize
                                                                                                                   //FontColor
                    PowerPoint.ShadowFormat shadow = shp.Shadow;                                                   //Shadow
                                                                                                                   //PowerPoint.PpChangeCase txcase = shp.TextFrame.TextRange.ChangeCase;                //Case
                    PowerPoint.BulletFormat         txbuttlet = shp.TextFrame.TextRange.ParagraphFormat.Bullet;    //ParagraphBullet
                    PowerPoint.PpParagraphAlignment txtAlig   = shp.TextFrame.TextRange.ParagraphFormat.Alignment; //ParagraphAlignment
                    MsoTriState hPun = shp.TextFrame.TextRange.ParagraphFormat.HangingPunctuation;                 //ParagraphHangingPunctuation
                    float       psb  = shp.TextFrame.TextRange.ParagraphFormat.SpaceBefore;                        //ParagraphSpaceBefore
                    float       psa  = shp.TextFrame.TextRange.ParagraphFormat.SpaceAfter;                         //ParagraphSpaceAfter
                    float       psw  = shp.TextFrame.TextRange.ParagraphFormat.SpaceWithin;                        //ParagraphSpaceWithin
                    float       rlfm = shp.TextFrame.Ruler.Levels[1].FirstMargin;                                  //RulerLevel1FirstMargin
                    float       rllm = shp.TextFrame.Ruler.Levels[1].LeftMargin;                                   ////RulerLevel1LeftMargin
                    for (int i = 1; i <= shp.TextFrame.TextRange.Paragraphs().Count; i++)
                    {
                        string paraStr   = shp.TextFrame.TextRange.Paragraphs(i).Text;
                        int    indentVal = shp.TextFrame.TextRange.Paragraphs(i).IndentLevel;
                    }

                    specification.Append("LineVisible :" + vstatus + Environment.NewLine + "FillVisible :" + fillStatus + Environment.NewLine + "FillTransparency :" + fillTrasn + Environment.NewLine);
                    specification.Append("ShapeLeft :" + sleft + Environment.NewLine + "ShapeTop :" + stop + Environment.NewLine + "ShapeWeight :" + swidth + Environment.NewLine + "ShapeHeight :" + shpHeight + Environment.NewLine);


                    specification.Append("Rotaion :" + rot + Environment.NewLine + "LockAspectRatio :" + lrvalue + Environment.NewLine + "Orientation :" + txtOrientation + Environment.NewLine + "VerticalAnchor :" + txtAnchor + Environment.NewLine);
                    specification.Append("AutoSize :" + autosize + Environment.NewLine + "MarginLeft :" + mgleft + Environment.NewLine + "MarginRight :" + mgRight + Environment.NewLine + "MarginTop :" + mgtop + Environment.NewLine);
                    specification.Append("MarginBottom :" + mgbottom + Environment.NewLine + "WordWrap :" + wWrap + Environment.NewLine + "DefaultText :" + dtext + Environment.NewLine + "FontName :" + fname + Environment.NewLine);
                    specification.Append("Bold :" + txbold + Environment.NewLine + "Italics :" + txItalics + Environment.NewLine + "Underline :" + txUnderline + Environment.NewLine + "FontSize :" + txsize + Environment.NewLine);
                    specification.Append("Shadow :" + shadow + Environment.NewLine + "ParagraphBullet :" + txbuttlet + Environment.NewLine + "ParagraphAlignment :" + txtAlig + Environment.NewLine + "ParagraphHangingPunctuation :" + hPun + Environment.NewLine);
                    specification.Append("ParagraphSpaceBefore :" + psb + Environment.NewLine + "ParagraphSpaceAfter :" + psa + Environment.NewLine + "ParagraphSpaceWithin :" + psw + Environment.NewLine + "RulerLevel1FirstMargin :" + rlfm + Environment.NewLine);
                    specification.Append("RulerLevel1LeftMargin :" + rllm);
                    PPTAttribute.saveSpacification(specification, shp.Name);
                }
            }
        }