Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 980
  • Last Modified:

How to export powerpoint slides to pictures?

I am working on a c# app, and I want to use my app to read a powerpoint file, and than export them into pictures that the pictures' name is the ppt's page title name so that I can use the picutures. Please help me !!
0
ed_dalian
Asked:
ed_dalian
  • 5
  • 3
1 Solution
 
ed_dalianAuthor Commented:
I want it on powerpoint 2003
0
 
Bob LearnedCommented:
Export what into pictures?  The slides?

Bob
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
ed_dalianAuthor Commented:
Yes, I want more people could see it, so that I could get more help, please help me.
0
 
Bob LearnedCommented:
First of all, it is just confusing if I see the same question twice.  It is recommended to only ask the question once, and then add a "pointer" question.
0
 
Bob LearnedCommented:
Here is a class to work with PowerPoint:

// 1) Add a COM reference to the Micro$oft PowerPoint 11.0 type library.
// 2) Add a COM reference to the Micro$oft Graph 11.0 type library.

using System;
using System.Drawing;
using Microsoft.Office.Interop;
using Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Core;
using System.Runtime.InteropServices;
using System.Reflection;

public enum SaveAsType
{
  AddIn = PpSaveAsFileType.ppSaveAsAddIn,
  BMP = PpSaveAsFileType.ppSaveAsBMP,
  Default = PpSaveAsFileType.ppSaveAsDefault,
  EMF = PpSaveAsFileType.ppSaveAsEMF,
  GIF = PpSaveAsFileType.ppSaveAsGIF,
  Html = PpSaveAsFileType.ppSaveAsHTML,
  HtmlDual = PpSaveAsFileType.ppSaveAsHTMLDual,
  HtmlV3 = PpSaveAsFileType.ppSaveAsHTMLv3,
  JPG = PpSaveAsFileType.ppSaveAsJPG,
  MetaFile = PpSaveAsFileType.ppSaveAsMetaFile,
  PNG = PpSaveAsFileType.ppSaveAsPNG,
  RTF = PpSaveAsFileType.ppSaveAsRTF,
  TIF = PpSaveAsFileType.ppSaveAsTIF,
  Presentation = PpSaveAsFileType.ppSaveAsPresentation
}

public class PowerPointPresentation
{

  private Application _app = new Application();
  private Presentation _presentation;
  private Slide _slide;

  ~PowerPointPresentation()
  {
    _app.DisplayAlerts = PpAlertLevel.ppAlertsNone;
    _presentation.Close();
    _app.Quit();
    Marshal.ReleaseComObject(_slide);
    Marshal.ReleaseComObject(_presentation);
    Marshal.ReleaseComObject(_app);
    _slide = null;
    _presentation = null;
    _app = null;
  }

  public bool ApplicationVisible
  {
    get { return (_app.Visible == MsoTriState.msoTrue);
    }
    set
    {
      if (value)
      {
        _app.Visible = MsoTriState.msoTrue;
      }
      else
      {
        _app.Visible = MsoTriState.msoFalse;
      }
    }
  }

  public void OpenPresentation(string fileName)
  {
    if (_app == null)
    {
      throw new ArgumentNullException("Application not initialized");
    }
    _presentation = _app.Presentations.Open(fileName,
      MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
  }

  public void SelectSlide(int index)
  {
    _slide = this.GetSlide(index);
  }

  public void SaveAs(string fileName)
  {
    this.SaveAs(fileName, SaveAsType.Presentation);
  }

  public void SaveAs(string fileName, SaveAsType type)
  {
    _presentation.SaveAs(fileName, (PpSaveAsFileType)type, MsoTriState.msoFalse);
  }

  public Slide GetSlide(int index)
  {
    if (_presentation == null)
    {
      throw new ArgumentNullException("Presentation not open");
    }
    if (index < 1 || index > _presentation.Slides.Count)
    {
      throw new ArgumentOutOfRangeException("Out of range", "Slide");
    }
    return _presentation.Slides[index];
  }

}

Bob
0
 
Bob LearnedCommented:
Example:

  PowerPointPresentation pps = new PowerPointPresentation();
  pps.OpenPresentation(@"C:\Temp\Presentation1.ppt");
  pps.SaveAs(@"C:\Temp\Presentation.jpg", SaveAsType.JPG);

Bob
0
 
ed_dalianAuthor Commented:
TheLearnedOne , Thank you very much!
0

Featured Post

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now