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

Free Support Forum - aspose.com

POTX files causing IndexOutOfRangeException

Hi,

I’m using Aspose.Slides to generate slide thumbnails within an ASP.NET application. This works fine for PPT and PPTX files, but when using POTX files, I’m getting the following error:

System.IndexOutOfRangeException: Index was outside the bounds of
the array. at .() at .( , Int32 ) at .() at .(Stream ) at
Aspose.Slides.Presentation…ctor(String file) at [application-specific info removed].


This error occurs on the following line:

Presentation presentation = new Presentation(inputFile);

The version of Aspose.Slides is 3.1.1.0 and the web application is ASP.NET 2.0.

According to the documentation. Slides should support POTX files, so any advice on why this problem is occurring and how to resolve it would be greatly appreciated.

Thanks.

Mun

Hi Mun,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your interest in Aspose.Slides.

I have worked upon your mentioned issue. I used my own POTX file and tested that with Aspose.Slides for .NET 3.1.1 and Aspose.Slides 4.1.1. I am successfully able to open the POTX file. Can you please share your POTX file, so that we mat investigate further? Please also try opening that file with the latest version of Aspose.Slides for .NET 4.1.1 available here.

We are sorry for your inconvenience,

Hi Mudassir,

Thanks for the response.

I’ve tried various POTX files, all of which cause the same IndexOutOfRangeException error. For example, this template from Microsoft:

http://office.microsoft.com/en-us/templates/TC103382711033.aspx?CategoryID=CT103366151033

Have you got a sample POTX file that you can confirm is working, which I could try using in my application?

Thanks.

Mun

Dear Mun,

I have successfully generated the slide thumbnail of a POTX file in ASP.NET. For your kind reference, I have also attached the sample POTX file that I have used for my implementation as well as the generated thumbnail image. I have used Aspose.Slides for .NET 4.1.1 for my implementation, so please kindly use the said version available here.

Please share the POTX file or files in which you are experiencing problem along with the code snippet. We appreciate your cooperation in advance.

Thanks and Regards,

Hi Mudassir,

I’ve tested the sample POTX file you supplied and am still getting the same error. Are any other files other than Aspose.Slides DLL required? If I recall correctly, I had a similar type of error with Aspose.Pdf.Kit and had to include the Aspose.Pdf.Kit.res file in the bin folder, but there doesn’t appear to be a res file for Aspose.Slides.

Upgrading to 4.1.1 is only something I’m willing to do as a last resort if there is no other way, as POTX should really be supported in 3.1.1.

Thanks.

Mun

Hi Mudassir,

I’ve tried using Aspose.Slides 4.1.1 with your Sample POTX file and am getting the following error:

Aspose.Slides.UnsupportedFormatException: The file is ZIP archive. It can be Microsoft PowerPoint 2007 PPTX presentation.
at j8.a()
at j8…ctor(Stream A_0)
at fc.c()
at fc.e()
at r9.a(Stream A_0)
at Aspose.Slides.Presentation.a(Stream A_0)
at Aspose.Slides.Presentation…ctor(String file)
at
[app-specific info removed]


The line of code where the error occurs is:

Presentation presentation = new Presentation(inputFile);

Regards,

Mun

Hi Mudassir,

Attached is a very basic website project which illustrates this problem. Uploading PPT and PPTX files work correctly - the preview image is created. However, when trying to the same for POTX files, an error is generated. This problem occurs when using both versions 3.1.1 and 4.1.1 of the Aspose.Slides component.

The zip file includes a “Files” folder with a working PPT file and your non-working POTX file.

Regards,

Mun

Hi Mun,

I have investigated the code snippet provided by you. There has been a little mistake that was actually responsible for raising such exception. POTX format is supported by Aspose.Slides.PPTX API as it belongs to MS PowerPoint 2007 formats. So, instead of using Presentation class, please use PresentationEx class for POTX files.

Moreover, Aspose.Slides for .NET 3.1.1 does not support Slide.GetThumbnail() method implementation for PPTX. For this, you may please upgrade to next newer version of Aspose.Slides for .NET that contains Slide.GetThumbnail() implementation in it. I have modified the code snippet provided by you. Please use this and it will hopefully work fine.I have executed the code snippet by using Aspose.Slides for .NET 4.1.1.

Thanks and Regards,

Hi Mudassir,

Thanks for the revised code. This seems to work, though it’s a bit disappointing that that there isn’t a consistent way to generate thumbnails in a consistent way for both PPT and POTX files. It seems like the only solution is to check the extension of the uploaded file and then use the Presentation or PresentationEx classes accordingly.

Regards,

Mun