We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Needing two different namespaces to convert pptx vs ppt

I need to be able to covert to image both ppt (1997 to 2003) and pptx (2003 and later). Is it necessary to use two different namespaces Aspose.Slides.Pptx and Aspose.Slides?

Also, how can I detect the version?

Thank you.


This message was posted using Aspose.Live 2 Forum

Hi,

Which version information do you want? As far as PowerPoint presentation version is concerned, you will have to use Aspose.Slides namespace for working with PPT (PowerPoint 2003) and Aspose.Slides.Pptx for working with PPTX (PowerPoint 2007). Here is how you can render a ppt / pptx slide to image:

1) For PPTX:

PresentationEx pres = new PresentationEx("issuesource.pptx");

SlideEx sld = pres.Slides[0];

Bitmap btmp = sld.GetThumbnail(1f, 1f);

btmp.Save("issuesource.jpg", ImageFormat.Jpeg);

2) For PPT:

Presentation pres = new Presentation("issuesource.pptx");

Slide sld = ppt.GetSlideByPosition(1);

Bitmap btmp = sld.GetThumbnail(1f, 1f);

btmp.Save("issuesource.jpg", ImageFormat.Jpeg);

Sir,

I did not ask the question about version clearly and I apologize for that. I meant how can I tell via the Aspose dll, or some method other than by extension, what version of a PowerPoint file is being converted to images? (If I am iterating through a directory that has both (1997 - 2003 and 2003 and beyond versions in it, I’d want to use the correct namespace.

Thank you for the samples and for differentiating the namespaces.

Hi,

As Aspose.Slides for .NET provides support for PPT and PPTX. Using .NET Framework class library, you can determine the extension and hence use corresponding Aspose.Slides namespace like the following example:

string[] strFiles = Directory.GetFiles("d:\\ppt\\");

for (int i = 0; i < strFiles.Length; i++)

{

if (File.Exists(strFiles[i]))

{

FileInfo finfo = new FileInfo(strFiles[i]);

if (finfo.Extension.EndsWith("ppt"))

{

//ppt code

}

else if (finfo.Extension.EndsWith("pptx"))

{

//pptx code

}

}

}