1

I am able to split a file when the extension is ".ppt" by using the Microsoft.office.interop.powerpoint.presentation.slide export method but for the pptx files it is not working.

Any help?

Nahuel Ianni
  • 3,177
  • 4
  • 23
  • 30
user3866053
  • 21
  • 1
  • 7
  • Read about OpenXML - .NET API to read, create and manipulate Microsoft Office files, including .pptx - http://msdn.microsoft.com/en-us/library/office/bb448854(v=office.15).aspx – MarcinJuraszek Aug 01 '14 at 07:09
  • I had the same question for a current project, but then I took another road and I'm using [slideshare.net](http://www.slideshare.net) API to upload and get the PowerPoint as a readable slide... you might take a look at it. – balexandre Aug 01 '14 at 07:20

2 Answers2

0

You could convert *.pptx file to *.ppt file before splitting it.

Some sample code for your reference:

using System;
using System.Collections.Generic;
using System.Text;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Core;

namespace pptxTOppt
{
    class Program
    {
        static void Main(string[] args)
        {
            PowerPoint.Application app = new PowerPoint.Application();
            string sourcePptx = @"c:\test.pptx";
            string targetPpt = @"c:\test.ppt";
            object missing = Type.Missing;
            PowerPoint.Presentation pptx = app.Presentations.Open(sourcePptx, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoTrue);
            pptx.SaveAs(targetPpt, PowerPoint.PpSaveAsFileType.ppSaveAsPowerPoint4);
            app.Quit();
        }
    }
}

Referenced from the below link: http://social.msdn.microsoft.com/Forums/office/en-US/df79729d-a2a0-4e1e-9620-02248c171e62/c-code-to-convert-pptx-to-ppt?forum=Offtopic

Praveen Manupati
  • 434
  • 1
  • 6
  • 12
0

Too too late reply. But this might help someone else

 foreach ( Slide slides in Pres.Slides)
   {
      slides.Export(Filename, "pptx" (or the target type), Scale-Width, Scale-Height); 
    }
Amal Ps
  • 703
  • 7
  • 19