예제 #1
0
 public MsoTextOrientation getOrientation(int dVal)
 {
     try
     {
         if (dVal == 3)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationDownward;
         }
         else if (dVal == 3)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationDownward;
         }
         else if (dVal == 1)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationHorizontal;
         }
         else if (dVal == 6)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationHorizontalRotatedFarEast;
         }
         else if (dVal == -2)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationMixed;
         }
         else if (dVal == 2)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationUpward;
         }
         else if (dVal == 5)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationVertical;
         }
         else if (dVal == 4)
         {
             objValue6 = MsoTextOrientation.msoTextOrientationVerticalFarEast;
         }
     }
     catch (Exception err)
     {
         string errtext = err.Message;
         PPTAttribute.ErrorLog(errtext, "getOrientation");
     }
     return(objValue6);
 }
예제 #2
0
        public XlShape AddTextbox(MsoTextOrientation orientation, Single left, Single top, Single width, Single height)
        {
            object[] parameters = new object[5];
            parameters[0] = orientation;
            parameters[1] = left;
            parameters[2] = top;
            parameters[3] = width;
            parameters[4] = height;
            object returnValue = InstanceType.InvokeMember("AddTextbox", BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding, null, ComReference, parameters, XlLateBindingApiSettings.XlThreadCulture);

            if (null == returnValue)
            {
                return(null);
            }
            XlShape newClass = new XlShape(this, returnValue);

            ListChildReferences.Add(newClass);
            return(newClass);
        }
        /// <summary>创建一个文本框。返回一个代表新文本框的 Shape 对象。
        /// </summary>
        /// <param name="Orientation">文本框的方向。</param>
        /// <param name="Left">文本框左上角相对于文档左上角的位置(以磅为单位)。</param>
        /// <param name="Top">文本框左上角相对于文档顶部的位置(以磅为单位)。</param>
        /// <param name="Width">文本框的宽度(以磅为单位)。</param>
        /// <param name="Height">文本框的高度(以磅为单位)。</param>
        /// <returns></returns>
        public Shape AddTextbox(MsoTextOrientation Orientation, double Left, double Top, double Width, double Height)
        {
            _objaParameters = new object[5] { Orientation, Left, Top, Width, Height };
            object objShape = _objShapes.GetType().InvokeMember("AddTextbox", BindingFlags.InvokeMethod, null, _objShapes, _objaParameters);

            return new Shape(objShape);
        }
예제 #4
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);
                }
            }
        }
        /// <summary>创建一个连接符。返回一个代表新连接符的 Shape 对象。
        /// </summary>
        /// <param name="Orientation">标签中文本的方向。</param>
        /// <param name="Left">标签左上角相对于文档左上角的位置(以磅为单位)。</param>
        /// <param name="Top">标签左上角相对于文档顶部的位置(以磅为单位)。</param>
        /// <param name="Width">标签的宽度(以磅为单位)。</param>
        /// <param name="Height">标签的高度(以磅为单位)。</param>
        /// <returns></returns>
        public Shape AddLabel(MsoTextOrientation Orientation, float Left, float Top, float Width, float Height)
        {
            _objaParameters = new object[5] { Orientation, Left, Top, Width, Height };
            object objShape = _objShapes.GetType().InvokeMember("AddLabel", BindingFlags.InvokeMethod, null, _objShapes, _objaParameters);

            return new Shape(objShape);
        }