PptUnsupportedFormatException when loading newly created file pptx

Hi,

I don’t understand why I have this exception with this code :

        using (MemoryStream stream = new MemoryStream())
        {
            using (Presentation presentation = new Presentation())
            {
                ISlide slide = presentation.Slides[0];
                IAutoShape shape = slide.Shapes.AddAutoShape(ShapeType.Rectangle, 50, 50, 300, 300);
                shape.AddTextFrame("Hello World");
                presentation.Save(stream,Aspose.Slides.Export.SaveFormat.Pptx);
            }
            Presentation pptx = new Presentation(stream); => Exception here (?)
        }

I did same thing with xlsx and doc files with no problems.

I tried with loadOptions but there is no ‘pptx’ in the enumeration.

Any idea ?

Thanks in advance

@ArnoStalgik,

I have observed the above code statement. You actually need to set the stream position to 0 before using.

stream.Position=0;

Hi, thank you very much for your help. The problem was exactly what you described.

Thank again and have a nice day.