예제 #1
0
 private void  除空白页ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (fName != "")
     {
         PowerPoint.Application  pptapp = new PowerPoint.Application();
         PowerPoint.Presentation pptpr  = pptapp.Presentations.Open(fName, Office.MsoTriState.msoFalse, Office.MsoTriState.msoFalse, Office.MsoTriState.msoFalse);
         int n = 0;
         for (int i = pptpr.Slides.Count; i >= 1; i--)
         {
             PowerPoint.Slide oslide = pptpr.Slides[i];
             if (oslide.Shapes.Count == 0)
             {
                 oslide.Delete();
                 n += 1;
             }
         }
         if (pptpr.Slides.Count == 0)
         {
             pptpr.Slides.AddSlide(1, pptpr.SlideMaster.CustomLayouts[7]);
         }
         pptpr.Save();
         Properties.Settings.Default.GalleryRefresh = 1;
         pptpr.Close();
         MessageBox.Show("共删除了 " + n + " 个空白页");
     }
     else
     {
         MessageBox.Show("请先加载库");
     }
 }
        private void DeleteSlide(int index)
        {
            //TODO: try-catch
            PPT.Application   app  = new PPT.Application();
            PPT.Presentations pres = app.Presentations;

            PPT.Presentation pptx = pres.Open(LibraryFile.FullPath, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);

            PPT.Slides slides = pptx.Slides;
            PPT.Slide  slide  = slides[index];

            slide.Delete();

            pptx.Save();
            pptx.Close();

            slide.ReleaseCOM();
            slide = null;

            slides.ReleaseCOM();
            slides = null;

            pptx.ReleaseCOM();
            pptx = null;

            pres.ReleaseCOM();
            pres = null;

            app.ReleaseCOM();
            app = null;
        }
예제 #3
0
 public void deleteSlide(int sileIndex)
 {
     PowerPoint.Slide slide = getSilde(sileIndex);
     if (slide == null)
     {
         return;
     }
     slide.Delete();
 }
예제 #4
0
        public string CommitBuild()
        {
            templateSlide.Delete();
            workingPPT.Save();
            workingPPT.Close();

            if (isTemporaryTask)
            {
                File.Move(workingFile, workingFile + ".pptx");
                workingFile += ".pptx";
            }
            return(workingFile);
        }
예제 #5
0
 /// <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();
 }
예제 #6
0
 public void Save()
 {
     TemplateSlide?.Delete();
     WorkingPPT?.Save();
 }