none
C# Powerpoint Slides as Image export RRS feed

Antworten

  • Hello,

    for PowerPoint 2010:

    in GUI: File -> Save As... -> Choose File-Type (e.g. jpg). You will be prompted if you want to save the current or all slides

    in Code: If you have the 'Slide' Instance (e.g. Application.ActivePresentation.Slides[1]), you can use the 'Export' Method:

    slide.Export("C:\\temp\\slide.jpg", "JPG");
    

    OK?

    mfg GP


    Günter Prossliner, MSCD MSDBA
    Mittwoch, 4. August 2010 11:54

Alle Antworten

  • Hello,

    for PowerPoint 2010:

    in GUI: File -> Save As... -> Choose File-Type (e.g. jpg). You will be prompted if you want to save the current or all slides

    in Code: If you have the 'Slide' Instance (e.g. Application.ActivePresentation.Slides[1]), you can use the 'Export' Method:

    slide.Export("C:\\temp\\slide.jpg", "JPG");
    

    OK?

    mfg GP


    Günter Prossliner, MSCD MSDBA
    Mittwoch, 4. August 2010 11:54
  • Hey Günter!

     

    Thanks for your reply (Grüße von einem ehemaligen WD-Mitarbeiter)! I already found the solution.

    For others: You need the following Refernces for the project:

    Microsoft.Office.Core and Microsoft.Office.Interop.PowerPoint

            ApplicationClass appPowerpoint = new ApplicationClass();
            Presentation pres = appPowerpoint.Presentations.Open(ppFilePath, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
            foreach (Slide s in pres.Slides)
            {
              string id = Guid.NewGuid().ToString();
              s.Export(Path.Combine(destinationPath, id.ToString() + ".jpg"), "jpg", imageWidth, imageHeight);
    
            }
    

    That easy!

    Donnerstag, 19. August 2010 07:09