当前位置: 首页>>代码示例>>C#>>正文


C# Interop.PowerPoint类代码示例

本文整理汇总了C#中Microsoft.Office.Interop.PowerPoint的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Office.Interop.PowerPoint类的具体用法?C# Microsoft.Office.Interop.PowerPoint怎么用?C# Microsoft.Office.Interop.PowerPoint使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Microsoft.Office.Interop.PowerPoint类属于命名空间,在下文中一共展示了Microsoft.Office.Interop.PowerPoint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Application_SlideSelectionChanged

        void Application_SlideSelectionChanged(PowerPoint.SlideRange SldRange)
        {
            try
            {

                if (SldRange != null)
                {
                    if (currentlyViewed == "add")
                    {
                        try
                        {
                            addDictionaries.showSlideNumber(SldRange.SlideID.ToString(), SldRange.SlideNumber.ToString());

                        }
                        catch (System.AccessViolationException ex) { }

                    }
                    else if (currentlyViewed == "update")
                    {
                        updateDictionaries.showSlideNumber(SldRange.SlideID.ToString(), SldRange.SlideNumber.ToString());
                    }

                }
            }
            catch (AccessViolationException avEx)
            {

            }
            catch (Exception ex)
            {

            }
        }
开发者ID:coachlab,项目名称:Planetarium-PowerPoint-Plugin,代码行数:33,代码来源:MainMenu.cs

示例2: AddAutoAnimation

 public void AddAutoAnimation(PowerPoint.Shape[] currentSlideShapes, PowerPoint.Shape[] nextSlideSlideShapes, int[] matchingShapeIDs)
 {
     PowerPoint.Shape indicatorShape = AddPowerPointLabsIndicator();
     ManageNonMatchingShapes(matchingShapeIDs, indicatorShape.Id);
     AnimateMatchingShapes(currentSlideShapes, nextSlideSlideShapes, matchingShapeIDs);
     indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
 }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:7,代码来源:PowerPointAutoAnimateSlide.cs

示例3: FromSlideFactory

        public static PowerPointSlide FromSlideFactory(PowerPoint.Slide slide)
        {
            if (slide == null)
                return null;

            return new PowerPointAutoAnimateSlide(slide);
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:7,代码来源:PowerPointAutoAnimateSlide.cs

示例4: VerifyIsShapeRangeValid

        private static bool VerifyIsShapeRangeValid(PowerPoint.ShapeRange shapeRange, bool handleError)
        {
            try
            {
                if (shapeRange.Count < 1)
                {
                    ThrowErrorCode(ErrorCodeForSelectionCountZero);
                }

                if (!IsShapeForSelection(shapeRange))
                {
                    ThrowErrorCode(ErrorCodeForSelectionNonShape);
                }

                return true;
            }
            catch (Exception e)
            {
                if (handleError)
                {
                    ProcessErrorMessage(e);
                    return false;
                }

                throw;
            }
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:27,代码来源:CropToShape.cs

示例5: EffectsDesigner

 /// <summary>
 /// For `preview`
 /// </summary>
 /// <param name="slide">the temp slide to produce preview image</param>
 /// <param name="contentSlide">the slide that contains content</param>
 /// <param name="slideWidth"></param>
 /// <param name="slideHeight"></param>
 /// <param name="source"></param>
 private EffectsDesigner(PowerPoint.Slide slide, PowerPoint.Slide contentSlide, 
     float slideWidth, float slideHeight, ImageItem source)
     : base(slide)
 {
     ContentSlide = contentSlide;
     Setup(slideWidth, slideHeight, source);
 }
开发者ID:digawp,项目名称:PowerPointLabs,代码行数:15,代码来源:EffectsDesigner.cs

示例6: GetShapesFromLinesInText

        private static List<PowerPoint.Shape> GetShapesFromLinesInText(PowerPointSlide currentSlide, Office.TextRange2 text, PowerPoint.Shape shape)
        {
            List<PowerPoint.Shape> shapesToAnimate = new List<PowerPoint.Shape>();

            foreach (Office.TextRange2 line in text.Lines)
            {
                PowerPoint.Shape highlightShape = currentSlide.Shapes.AddShape(
                    Office.MsoAutoShapeType.msoShapeRoundedRectangle,
                    line.BoundLeft,
                    line.BoundTop,
                    line.BoundWidth,
                    line.BoundHeight);

                highlightShape.Adjustments[1] = 0.25f;
                highlightShape.Fill.ForeColor.RGB = Utils.Graphics.ConvertColorToRgb(backgroundColor);
                highlightShape.Fill.Transparency = 0.50f;
                highlightShape.Line.Visible = Office.MsoTriState.msoFalse;
                Utils.Graphics.MoveZToJustBehind(highlightShape, shape);
                highlightShape.Name = "PPTLabsHighlightTextFragmentsShape" + Guid.NewGuid().ToString();
                highlightShape.Tags.Add("HighlightTextFragment", highlightShape.Name);
                highlightShape.Select(Office.MsoTriState.msoFalse);
                shapesToAnimate.Add(highlightShape);
            }

            return shapesToAnimate;
        }
开发者ID:suheti,项目名称:powerpointlabs,代码行数:26,代码来源:HighlightTextFragments.cs

示例7: TildaShape

 /**
  * Creates a new TildaShape Object from a powerpoint shape
  * @param PowerPoint.Shape
  */
 public TildaShape(PowerPoint.Shape shape, int id = 0)
 {
     this.shape = shape;
     this.scaler = Settings.Scaler();
     this.id = id;
     animations = new List<TildaAnimation>();
 }
开发者ID:parris,项目名称:tilda,代码行数:11,代码来源:TildaShape.cs

示例8: AutoFitColumn

        /// <summary>
        /// Update columns width to fit text (can only decrease size of columns!!)
        /// Looks like sometimes it doesn't work how it should.
        /// </summary>
        /// <param name="shape">Table shape</param>
        /// <param name="settings">Tabular settings (with information about columns)</param>
        /// <exception cref="ArgumentException"></exception>
        internal static void AutoFitColumn(PowerPoint.Shape shape, TabularSettings settings)
        {
            if (shape.HasTable != MsoTriState.msoTrue)
                throw new ArgumentException("Shape must have table.");

            PowerPoint.TextFrame2 frame;

            float width;

            for (int column = 1; column <= shape.Table.Columns.Count; column++)
            {
                if (settings.Columns[column - 1].alignment != 'p' || (settings.Columns[column - 1].alignment == 'p' && settings.Columns[column - 1].width == 0))
                {
                    width = 0.0f;
                    for (int row = 1; row <= shape.Table.Rows.Count; row++)
                    {
                        frame = shape.Table.Cell(row, column).Shape.TextFrame2;

                        width = Math.Max(width, frame.TextRange.BoundWidth + frame.MarginLeft + frame.MarginRight + 1);
                    }
                }
                else
                {
                    width = settings.Columns[column - 1].width;
                }

                shape.Table.Columns[column].Width = width;
            }
        }
开发者ID:blacker-cz,项目名称:SimpleConverter,代码行数:36,代码来源:Misc.cs

示例9: AdjustVisualWidthProportionally

        /// <summary>
        /// Adjust the visual width of the specified shapes to the resize factors of first
        /// selected shape's visual width.
        /// </summary>
        /// <param name="selectedShapes"></param>
        public void AdjustVisualWidthProportionally(PowerPoint.ShapeRange selectedShapes)
        {
            try
            {
                var referenceWidth = GetReferenceWidth(selectedShapes);

                if (referenceWidth <= 0 || AdjustProportionallyProportionList?.Count != selectedShapes.Count) return;

                for (int i = 1; i < AdjustProportionallyProportionList.Count; i++)
                {
                    var newWidth = referenceWidth*
                                   (AdjustProportionallyProportionList[i] / AdjustProportionallyProportionList[0]);
                    var shape = new PPShape(selectedShapes[i + 1]);
                    var anchorPoint = GetVisualAnchorPoint(shape);

                    shape.AbsoluteWidth = newWidth;
                    AlignVisualShape(shape, anchorPoint);
                }
                AdjustProportionallyProportionList = null;
            }
            catch (Exception e)
            {
                Logger.LogException(e, "AdjustVisualWidthProportionally");
            }
        }
开发者ID:nus-fboa2016-PL,项目名称:PowerPointLabs,代码行数:30,代码来源:ResizeLabMain.AdjustProportionally.cs

示例10: ManageNonMatchingShapes

 private void ManageNonMatchingShapes(PowerPoint.Shape shapeToZoom, PowerPoint.Shape indicatorShape)
 {
     foreach (PowerPoint.Shape sh in _slide.Shapes)
     {
         if (!sh.Equals(indicatorShape) && !sh.Equals(shapeToZoom))
         {
             if (!HasExitAnimation(sh))
             {
                 DeleteShapeAnimations(sh);
                 PowerPoint.Effect effectFade = _slide.TimeLine.MainSequence.AddEffect(sh, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                 effectFade.Exit = Office.MsoTriState.msoTrue;
                 effectFade.Timing.Duration = AutoAnimate.defaultDuration;
                 //fadeFlag = true;
             }
             else
             {
                 DeleteShapeAnimations(sh);
                 PowerPoint.Effect effectDisappear = null;
                 effectDisappear = _slide.TimeLine.MainSequence.AddEffect(sh, PowerPoint.MsoAnimEffect.msoAnimEffectAppear, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                 effectDisappear.Exit = Office.MsoTriState.msoTrue;
                 effectDisappear.Timing.Duration = 0;
             }
         }
     }
 }
开发者ID:suheti,项目名称:powerpointlabs,代码行数:25,代码来源:PowerPointDrillDownSlide.cs

示例11: FromSlideFactory

        public static new PowerPointSlide FromSlideFactory(PowerPoint.Slide slide)
        {
            if (slide == null)
                return null;

            return new PowerPointMagnifiedSlide(slide);
        }
开发者ID:suheti,项目名称:powerpointlabs,代码行数:7,代码来源:PowerPointMagnifiedSlide.cs

示例12: CropPicture

 private void CropPicture(PowerPoint.Shape picShape)
 {
     try
     {
         if (picShape.Left < 0)
         {
             picShape.PictureFormat.Crop.ShapeLeft = 0;
         }
         if (picShape.Top < 0)
         {
             picShape.PictureFormat.Crop.ShapeTop = 0;
         }
         if (picShape.Left + picShape.Width > SlideWidth)
         {
             picShape.PictureFormat.Crop.ShapeWidth = SlideWidth - picShape.Left;
         }
         if (picShape.Top + picShape.Height > SlideHeight)
         {
             picShape.PictureFormat.Crop.ShapeHeight = SlideHeight - picShape.Top;
         }
     }
     catch (Exception e)
     {
         // some kind of picture cannot be cropped
         Logger.LogException(e, "CropPicture");
     }
 }
开发者ID:nus-fboa2016-PL,项目名称:PowerPointLabs,代码行数:27,代码来源:EffectsDesigner.Common.cs

示例13: AppendText

        /// <summary>
        /// Append text with current internal formatting to the end of shape.
        /// </summary>
        /// <param name="shape">Text shape</param>
        /// <param name="text">Appended text</param>
        public void AppendText(PowerPoint.Shape shape, string text)
        {
            if (shape.HasTextFrame != MsoTriState.msoTrue)
                throw new ArgumentException("Shape must contain text frame.");

            AppendText(shape.TextFrame2.TextRange, text);
        }
开发者ID:blacker-cz,项目名称:SimpleConverter,代码行数:12,代码来源:TextFormat.cs

示例14: AddZoomToAreaAnimation

        public void AddZoomToAreaAnimation(PowerPoint.Shape zoomShape)
        {
            PrepareForZoomToArea(zoomShape);
            PowerPoint.Shape shapeToZoom = null, referenceShape = null;
            if (!ZoomToArea.backgroundZoomChecked)
            {
                shapeToZoom = GetShapeToZoom(zoomShape);
                referenceShape = GetReferenceShape(shapeToZoom);
                DefaultMotionAnimation.AddDefaultMotionAnimation(this, shapeToZoom, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
            }
            else
            {
                shapeToZoom = zoomSlideCroppedShapes.Duplicate()[1];
                DeleteShapeAnimations(shapeToZoom);
                PowerPointLabsGlobals.CopyShapePosition(zoomSlideCroppedShapes, ref shapeToZoom);

                referenceShape = GetReferenceShape(zoomShape);
                DefaultMotionAnimation.AddZoomToAreaMotionAnimation(this, shapeToZoom, zoomShape, referenceShape, 0.5f, PowerPoint.MsoAnimTriggerType.msoAnimTriggerAfterPrevious);
            } 

            shapeToZoom.Name = "PPTLabsMagnifyAreaSlide" + DateTime.Now.ToString("yyyyMMddHHmmssffff");
            referenceShape.Delete();
            zoomSlideCroppedShapes.Visible = Office.MsoTriState.msoFalse;
            indicatorShape.ZOrder(Office.MsoZOrderCmd.msoBringToFront);
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:25,代码来源:PowerPointMagnifyingSlide.cs

示例15: PrepareForZoomToArea

        private void PrepareForZoomToArea(PowerPoint.Shape zoomShape)
        {
            MoveMotionAnimation();

            //Delete zoom shapes and shapes with exit animations
            List<PowerPoint.Shape> shapes = _slide.Shapes.Cast<PowerPoint.Shape>().ToList();
            var matchingShapes = shapes.Where(current => (HasExitAnimation(current) || current.Equals(zoomShape)));
            foreach (PowerPoint.Shape s in matchingShapes)
                s.Delete();

            AddZoomSlideCroppedPicture();

            DeleteSlideNotes();
            DeleteSlideMedia();
            ManageSlideTransitions();
            indicatorShape = AddPowerPointLabsIndicator();

            //Add fade out effect for non-zoom shapes
            shapes = _slide.Shapes.Cast<PowerPoint.Shape>().ToList();
            matchingShapes = shapes.Where(current => (!(current.Equals(indicatorShape) || current.Equals(zoomSlideCroppedShapes))));
            foreach (PowerPoint.Shape s in matchingShapes)
            {
                DeleteShapeAnimations(s);
                if (!ZoomToArea.backgroundZoomChecked)
                {
                    PowerPoint.Effect effectFade = _slide.TimeLine.MainSequence.AddEffect(s, PowerPoint.MsoAnimEffect.msoAnimEffectFade, PowerPoint.MsoAnimateByLevel.msoAnimateLevelNone, PowerPoint.MsoAnimTriggerType.msoAnimTriggerWithPrevious);
                    effectFade.Exit = Office.MsoTriState.msoTrue;
                    effectFade.Timing.Duration = 0.25f;
                }
                else
                    s.Visible = Office.MsoTriState.msoFalse;
            }
        }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:33,代码来源:PowerPointMagnifyingSlide.cs


注:本文中的Microsoft.Office.Interop.PowerPoint类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。