예제 #1
0
 private static Shape ImportPictureToSlide(PowerPointSlide slideToAdd, PowerPointSlide targetSlide, string tempFilePath)
 {
     // The AccessViolationException is longer catchable
     if (!FileDir.IsFileReadable(tempFilePath))
     {
         return(targetSlide.Shapes.SafeCopySlide(slideToAdd));
     }
     else
     {
         return(targetSlide.Shapes.AddPicture2(tempFilePath,
                                               MsoTriState.msoFalse,
                                               MsoTriState.msoTrue,
                                               0,
                                               0));
     }
 }
예제 #2
0
 private static Shape ImportPictureToSlide(Shape shapeToAdd, Slide targetSlide, string tempFilePath)
 {
     // The AccessViolationException is no longer catchable
     if (!FileDir.IsFileReadable(tempFilePath))
     {
         return(PPLClipboard.Instance.LockAndRelease(() =>
         {
             shapeToAdd.Cut();
             return targetSlide.Shapes.PasteSpecial(PpPasteDataType.ppPastePNG)[1];
         }));
     }
     else
     {
         shapeToAdd.Delete();
         return(targetSlide.Shapes.AddPicture2(tempFilePath,
                                               MsoTriState.msoFalse,
                                               MsoTriState.msoTrue,
                                               0,
                                               0));
     }
 }