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


C# Microsoft.Office.Interop.PowerPoint.Delete方法代码示例

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


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

示例1: ConvertToPictureForShape

 private static void ConvertToPictureForShape(PowerPoint.Shape shape)
 {
     float rotation = 0;
     try
     {
         rotation = shape.Rotation;
         shape.Rotation = 0;
     }
     catch (Exception e)
     {
         PowerPointLabsGlobals.LogException(e, "Chart cannot be rotated.");
     }
     shape.Copy();
     float x = shape.Left;
     float y = shape.Top;
     float width = shape.Width;
     float height = shape.Height;
     shape.Delete();
     var pic = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.PasteSpecial(PowerPoint.PpPasteDataType.ppPastePNG)[1];
     pic.Left = x + (width - pic.Width) / 2;
     pic.Top = y + (height - pic.Height) / 2;
     pic.Rotation = rotation;
     pic.Select();
 }
开发者ID:oswellchan,项目名称:PowerPointLabs,代码行数:24,代码来源:ConvertToPicture.cs

示例2: RenderSpotlightPicture

        /// <summary>
        /// Export formatted spotlight picture as a new picture,
        /// then use the new pic to replace the formatted one.
        /// Thus when it's displayed, no need to render the effect (which's very slow)
        /// </summary>
        /// <param name="spotlightPicture"></param>
        private void RenderSpotlightPicture(PowerPoint.Shape spotlightPicture)
        {
            string dirOfRenderedPicture = Path.GetTempPath() + @"\rendered_" + spotlightPicture.Name;
            //Render process:
            //export formatted spotlight picture to a temp folder
            spotlightPicture.Export(dirOfRenderedPicture, PowerPoint.PpShapeFormat.ppShapeFormatPNG);
            //then add the exported new picture back
            var renderedPicture = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.AddPicture(
                dirOfRenderedPicture, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue,
                spotlightPicture.Left, spotlightPicture.Top, spotlightPicture.Width, spotlightPicture.Height);

            renderedPicture.Name = spotlightPicture.Name + "_rendered";
            spotlightPicture.Delete();
        }
开发者ID:LIUJIAHAOCS,项目名称:powerpointlabs,代码行数:20,代码来源:PowerPointSpotlightSlide.cs

示例3: GenerateTable


//.........这里部分代码省略.........
                                    {
                                        tableShape.Table.Cell(rowCounter, columnCounter + merge_count - 1).Borders[PowerPoint.PpBorderType.ppBorderRight].ForeColor.RGB = 0x0;
                                        tableShape.Table.Cell(rowCounter, columnCounter + merge_count - 1).Borders[PowerPoint.PpBorderType.ppBorderRight].DashStyle = MsoLineDashStyle.msoLineSolid;
                                    }

                                    // set cell alignment
                                    switch (mset.Columns[0].alignment)
                                    {
                                        case 'l':
                                            shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignLeft;
                                            break;
                                        case 'c':
                                            shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignCenter;
                                            break;
                                        case 'r':
                                            shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignRight;
                                            break;
                                        case 'p':
                                            shape.TextFrame2.TextRange.ParagraphFormat.Alignment = MsoParagraphAlignment.msoAlignJustify;
                                            break;
                                        default:
                                            break;
                                    }

                                    // skip merged columns
                                    columnCounter += merge_count - 1;
                                }
                            }
                        }
                    }
                }
                else if(node.Type == "hline")
                {
                    if (rowCounter == 0)
                    {
                        tableShape.Table.Rows[1].Cells.Borders[PowerPoint.PpBorderType.ppBorderTop].ForeColor.RGB = 0x0;
                        tableShape.Table.Rows[1].Cells.Borders[PowerPoint.PpBorderType.ppBorderTop].DashStyle = MsoLineDashStyle.msoLineSolid;
                    }
                    else
                    {
                        tableShape.Table.Rows[rowCounter].Cells.Borders[PowerPoint.PpBorderType.ppBorderBottom].ForeColor.RGB = 0x0;
                        tableShape.Table.Rows[rowCounter].Cells.Borders[PowerPoint.PpBorderType.ppBorderBottom].DashStyle = MsoLineDashStyle.msoLineSolid;
                    }
                }
                else if (node.Type == "cline")
                {
                    Regex regex = new Regex(@"^([0-9]+)-([0-9]+)$", RegexOptions.IgnoreCase);

                    string range = node.Content as string;

                    Match match = regex.Match(range.Trim());

                    if (match.Success)
                    {
                        int x, y;

                        if (int.TryParse(match.Groups[1].Value, out x) && int.TryParse(match.Groups[2].Value, out y))
                        {
                            for (int i = Math.Min(x,y); i <= Math.Max(x,y); i++)
                            {
                                if (rowCounter == 0)
                                {
                                    tableShape.Table.Rows[1].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderTop].ForeColor.RGB = 0x0;
                                    tableShape.Table.Rows[1].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderTop].DashStyle = MsoLineDashStyle.msoLineSolid;
                                }
                                else
                                {
                                    tableShape.Table.Rows[rowCounter].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderBottom].ForeColor.RGB = 0x0;
                                    tableShape.Table.Rows[rowCounter].Cells[i].Borders[PowerPoint.PpBorderType.ppBorderBottom].DashStyle = MsoLineDashStyle.msoLineSolid;
                                }
                            }
                        }
                    }
                }
            }

            // resize table
            Misc.AutoFitColumn(tableShape, settings);

            // if processing was paused remove all lines after pause commands (columns are not supported yet)
            if (paused)
            {
                if (pausedAfter == 0)
                {
                    tableShape.Delete();
                    tableShape = null;
                }
                else
                {
                    for (int i = tableShape.Table.Rows.Count; i > pausedAfter; i--)
                    {
                        tableShape.Table.Rows[i].Delete();
                    }
                }

                return false;
            }

            return true;
        }
开发者ID:blacker-cz,项目名称:SimpleConverter,代码行数:101,代码来源:SlideBuilder.cs

示例4: RemoveShapesForUngroupAll

 private static void RemoveShapesForUngroupAll(PowerPoint.Shape shape, List<string> ungroupedShapes, Queue<PowerPoint.Shape> queue)
 {
     shape.Delete();
     if (ungroupedShapes.Count > 0)
     {
         PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Range(ungroupedShapes.ToArray()).Delete();
     }
     while (queue.Count != 0)
     {
         queue.Dequeue().Delete();
     }
 }
开发者ID:suheti,项目名称:powerpointlabs,代码行数:12,代码来源:CropToShape.cs

示例5: FillInShapeWithScreenshot

 private static PowerPoint.Shape FillInShapeWithScreenshot(PowerPoint.Shape shape, double magnifyRatio = 1.0)
 {
     if (shape.Type != Office.MsoShapeType.msoGroup)
     {
         CreateFillInBackgroundForShape(shape, magnifyRatio);
         shape.Fill.UserPicture(FillInBackgroundPicture);
     }
     else
     {
         using (var slideImage = (Bitmap)Image.FromFile(SlidePicture))
         {
             foreach (var shapeGroupItem in (from PowerPoint.Shape sh in shape.GroupItems select sh))
             {
                 CreateFillInBackground(shapeGroupItem, slideImage);
                 shapeGroupItem.Fill.UserPicture(FillInBackgroundPicture);
             }
         }
     }
     shape.Line.Visible = Office.MsoTriState.msoFalse;
     shape.Copy();
     var shapeToReturn = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Paste()[1];
     shape.Delete();
     return shapeToReturn;
 }
开发者ID:suheti,项目名称:powerpointlabs,代码行数:24,代码来源:CropToShape.cs

示例6: RecreateCorruptedShape

        private static void RecreateCorruptedShape(PowerPoint.Shape s)
        {
            s.Copy();
            PowerPoint.Shape newShape = PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.Paste()[1];

            newShape.Select();

            newShape.Name = s.Name;
            newShape.Left = s.Left;
            newShape.Top = s.Top;
            while (newShape.ZOrderPosition > s.ZOrderPosition)
            {
                newShape.ZOrder(Microsoft.Office.Core.MsoZOrderCmd.msoSendBackward);
            }
            s.Delete();
        }
开发者ID:nus-fboa2016-PL,项目名称:PowerPointLabs,代码行数:16,代码来源:ColorPane.cs

示例7: CreateQuestionnaireSlideRecord

 private async void CreateQuestionnaireSlideRecord(PowerPoint.Slide slide, QuestionnaireModel questionnaire)
 {
     try
     {
         var created = await _questionnaireUtil.CreateAsync(questionnaire);
         _questionnaireUtil.Mark(slide, created);
     }
     catch (WebException)
     {
         slide.Delete();
         MessageBox.Show("问卷添加失败了, 这可能是个网络错误.");
     }
 }
开发者ID:ccnuyan,项目名称:PowerPointQuestionnaire,代码行数:13,代码来源:QuestionnaireRibbon.cs

示例8: PictureTransparencyHandler

        private void PictureTransparencyHandler(PowerPoint.Shape picture)
        {
            var rotation = picture.Rotation;

            picture.Rotation = 0;

            var tempPicPath = Path.Combine(Path.GetTempPath(), "tempPic.png");

            Utils.Graphics.ExportShape(picture, tempPicPath);

            var shapeHolder =
                PowerPointCurrentPresentationInfo.CurrentSlide.Shapes.AddShape(
                    Office.MsoAutoShapeType.msoShapeRectangle,
                    picture.Left,
                    picture.Top,
                    picture.Width,
                    picture.Height);

            var oriZOrder = picture.ZOrderPosition;

            picture.Delete();

            // move shape holder to original z-order
            while (shapeHolder.ZOrderPosition > oriZOrder)
            {
                shapeHolder.ZOrder(Office.MsoZOrderCmd.msoSendBackward);
            }

            shapeHolder.Line.Visible = Office.MsoTriState.msoFalse;
            shapeHolder.Fill.UserPicture(tempPicPath);
            shapeHolder.Fill.Transparency = 0.5f;

            shapeHolder.Rotation = rotation;

            File.Delete(tempPicPath);
        }
开发者ID:youthinkk,项目名称:PowerPointLabs,代码行数:36,代码来源:Ribbon1.cs

示例9: DeleteSlide

 /// <summary>
 ///     Delete the specified slide from the presentation
 /// </summary>
 /// <param name="slide">PPT.Slide object instance to delete</param>
 public void DeleteSlide(PPT.Slide slide)
 {
     slide.Delete();
 }
开发者ID:prathapkora,项目名称:CodeSharper.PowerPoint.Helper,代码行数:8,代码来源:SlideManager.cs


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