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?
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?
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
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);
}