Note that there are some explanatory texts on larger screens.

plurals
  1. POC#: Powerpoint does not Quit?
    primarykey
    data
    text
    <p>I have a script that opens Powerpoint from my application and exports all slides. After that, I need the application to be closed.</p> <p>I've tried without any luck. Could you please help?</p> <pre><code>using System; using System.Collections.Generic; using System.Text; using System.IO; using Powerpoint = Microsoft.Office.Interop.PowerPoint; using Microsoft.Office.Core; using Microsoft.Office.Interop.PowerPoint; using System.Runtime.InteropServices; namespace PresentrBuilder { class PowerpointConverter { public static void Convert(String file, String safeFile) { Powerpoint.Application PP; Powerpoint.Presentation Presentation; PP = new Powerpoint.ApplicationClass(); PP.Visible = MsoTriState.msoTrue; PP.WindowState = Microsoft.Office.Interop.PowerPoint.PpWindowState.ppWindowMinimized; Presentation = PP.Presentations.Open(file, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue); // Voor elke slide, exporteren String exportSlidesPath = Path.Combine(Properties.Settings.Default.CacheDir, @"presentatienaam1\slides"); // Kijk of de directory bestaat if (!Directory.Exists(exportSlidesPath)) { Directory.CreateDirectory(exportSlidesPath); } // Kijk of er al bestanden in de directory staan // Zo ja: verwijderen String[] files = Directory.GetFiles(exportSlidesPath, "*.png"); if (files.Length &gt; 0) { foreach (string fileName in files) { File.Delete(Path.Combine(exportSlidesPath, fileName)); } } // Elke slide exporteren foreach (Slide slide in Presentation.Slides) { slide.Export(Path.Combine(exportSlidesPath, "slide_" + slide.SlideIndex + ".png"), "PNG", 1024, 768); Marshal.ReleaseComObject(slide); } GC.Collect(); GC.WaitForPendingFinalizers(); Marshal.ReleaseComObject(PP.Presentations); Marshal.ReleaseComObject(Presentation.Slides); Presentation.Close(); Marshal.FinalReleaseComObject(Presentation); PP.Quit(); Marshal.FinalReleaseComObject(PP); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload