2

I am trying to convert a .ppt file to a collection of images using C#.

I am using the following code :

using Microsoft.Office.Core;
using Microsoft.Office.Interop.PowerPoint;

.....

Microsoft.Office.Interop.PowerPoint.Application app = new Microsoft.Office.Interop.PowerPoint.Application();

Presentation pres = app.Presentations.Open(@"C:\Users\XYZ\Desktop\Presentation.ppt", MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);

pres.SaveAs(@"C:\Users\XYZ\Desktop\", PpSaveAsFileType.ppSaveAsJPG, MsoTriState.msoFalse);

pres.Close();

I am getting the following exception :

Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

at the line :

Microsoft.Office.Interop.PowerPoint.Application app = 
                      new Microsoft.Office.Interop.PowerPoint.Application();

Is it necessary to have full version of Office 2010 to be installed for this code to work ( I only have a Powerpoint Viewer installed ) or is there some other solution to this exception?

Oded
  • 489,969
  • 99
  • 883
  • 1,009
Jake
  • 16,329
  • 50
  • 126
  • 202
  • The issue is identical to that of your last question: http://stackoverflow.com/questions/5850499/c-convert-doc-to-htm Why are you repeating yourself? – Oded May 01 '11 at 19:13
  • @Oded: the error is the same, but these are two very different questions. – Todd Main May 01 '11 at 19:31
  • @Otaku - the issue is essentially the same (exception in office automation) and the OP is asking in both cases if this is due to not having the full office installed on the server. – Oded May 01 '11 at 19:33
  • @Oded: In one case he only has the PowerPoint viewer and in the other case he has Word Starter. Those are two very different issues as one is an actual production product and the other makes things read-only. The answer to the questions is completely different. Starter cannot be automated because of licensing issues, the Viewer simply can't be automated at all. – Todd Main May 01 '11 at 19:36
  • @Otaku - fair enough. Showing my office automation ignorance. – Oded May 01 '11 at 19:37

1 Answers1

1

You need the full PowerPoint installed in order to achieve this. The viewer cannot manipulate powerpoint files.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928