PPSX File Generated from MemoryStream Can’t Be Opened in PowerPoint

This code works for PPTX case but not for PPSX.
image.png (22.1 KB)

What is wrong? When I try to unzip it, it doesn’t work either. PPTX is not problem.

case ReportType.PPTX:
				{
					using var ms = new MemoryStream();
					var options = new PptxOptions();
					options.WarningCallback = _warningCallback;
					_managers[uuid].Presentation.Save(ms, Aspose.Slides.Export.SaveFormat.Pptx, options);
					ms.Position = 0;

					http.Response.ContentType =
						"application/vnd.openxmlformats-officedocument.presentationml.presentation";
					http.Response.Headers["Content-Disposition"] =
						$"attachment; filename=\"{_managers[uuid].TemplateName}.pptx\"";
					http.Response.ContentLength = ms.Length;

					await ms.CopyToAsync(http.Response.Body);
					await http.Response.Body.FlushAsync();
					break;
				}

				case ReportType.PPSX:
				{
					using var ms = new MemoryStream();
					var options = new PptxOptions();
					options.WarningCallback = _warningCallback;
					_managers[uuid].Presentation.Save(ms, Aspose.Slides.Export.SaveFormat.Ppsx, options);
					ms.Position = 0;

					http.Response.ContentType =
						"application/vnd.openxmlformats-officedocument.presentationml.slideshow";
					http.Response.Headers["Content-Disposition"] =
						$"attachment; filename=\"{_managers[uuid].TemplateName}.ppsx\"";
					http.Response.ContentLength = ms.Length;

					await ms.CopyToAsync(http.Response.Body);
					await http.Response.Body.FlushAsync();
					break;
				}

@karl.sjostrand

The PPS X file is corrupted because the options class does not match the target format.
In the PPT X block you correctly use PptxOptions, but in the PPS X block you also create a PptxOptions instance and then pass it to SaveFormat.Ppsx. Aspose.Slides expects a PpsxOptions object when saving to the PPS X format; using the wrong options class produces an invalid package that PowerPoint cannot open or unzip [0].

Fix – use the proper options class for PPS X

case ReportType.PPSX:
{
    using var ms = new MemoryStream();

    // Use the correct options type for PPSX
    var options = new Aspose.Slides.Export.PpsxOptions();
    options.WarningCallback = _warningCallback;

    _managers[uuid].Presentation.Save(ms,
        Aspose.Slides.Export.SaveFormat.Ppsx, options);
    ms.Position = 0;

    http.Response.ContentType =
        "application/vnd.openxmlformats-officedocument.presentationml.slideshow";
    http.Response.Headers["Content-Disposition"] =
        $"attachment; filename=\"{_managers[uuid].TemplateName}.ppsx\"";
    http.Response.ContentLength = ms.Length;

    await ms.CopyToAsync(http.Response.Body);
    await http.Response.Body.FlushAsync();
    break;
}

After replacing PptxOptions with PpsxOptions, the generated .ppsx file opens normally in PowerPoint and can be unzipped without errors [0].

PpsxOptions doesn’t not exist in the namespace.

I also tried without options, but it didn’t work either.

case ReportType.PPSX:
				{
					using var ms = new MemoryStream();
					_managers[uuid].Presentation.Save(ms, Aspose.Slides.Export.SaveFormat.Ppsx);
					ms.Position = 0;

					http.Response.ContentType =
						"application/vnd.openxmlformats-officedocument.presentationml.slideshow";
					http.Response.Headers["Content-Disposition"] =
						$"attachment; filename=\"{_managers[uuid].TemplateName}.ppsx\"";
					http.Response.ContentLength = ms.Length;

					await ms.CopyToAsync(http.Response.Body);
					await http.Response.Body.FlushAsync();
					break;
				}

I found the issue, it was in other part of code.

@karl.sjostrand

PpsxOptions is defined in the Aspose.Slides.Export namespace and must be used when the target format is PPSX. In the PPSX branch you are still creating a PptxOptions instance, which produces a corrupted package that PowerPoint cannot open or unzip [2].

Fix

using Aspose.Slides;
using Aspose.Slides.Export;   // <-- required for PpsxOptions

// ...

case ReportType.PPSX:
{
    using var ms = new MemoryStream();

    // Use the correct options type for PPSX
    var options = new PpsxOptions();          // Aspose.Slides.Export.PpsxOptions
    options.WarningCallback = _warningCallback;

    _managers[uuid].Presentation.Save(
        ms,
        SaveFormat.Ppsx,
        options);

    ms.Position = 0;
    http.Response.ContentType = "application/vnd.openxmlformats-officedocument.presentationml.slideshow";
    http.Response.Headers["Content-Disposition"] =
        $"attachment; filename=\"{_managers[uuid].TemplateName}.ppsx\"";
    http.Response.ContentLength = ms.Length;

    await ms.CopyToAsync(http.Response.Body);
    await http.Response.Body.FlushAsync();
    break;
}
  • Add using Aspose.Slides.Export; (or fully‑qualify the class as Aspose.Slides.Export.PpsxOptions) so the compiler can locate the type [2].
  • Ensure you are using a recent Aspose.Slides version (e.g., 25.10.0 or later) where PpsxOptions is available [2].

After replacing PptxOptions with PpsxOptions the generated .ppsx file opens correctly in PowerPoint and can be unzipped without errors [2].

@karl.sjostrand,

I tested your scenario by converting a sample PPTX file to PPSX using Aspose.Slides for .NET 25.12. The process worked smoothly, and the output PPSX file was generated properly. The output PPSX file is opened fine into MS PowerPoint. Below are the simplest lines of code that I am using:

// instantiate a Presentation object that represents a PPTX file
var presentation = new Presentation("e:\\test2\\Presentation1.pptx");
// save the presentation as PPSX
presentation.Save("e:\\test2\\output1.ppsx", Aspose.Slides.Export.SaveFormat.Ppsx); 

Could you please share a standalone sample VS.NET application (including the complete source code without any compilation errors) along with the presentation file (if applicable)? Please zip the project and attach it here, excluding the Aspose.Slides.Dll to keep the archive size minimal. This will help us reproduce the issue on our end, and we will review it soon.

Thanks for looking into this. As I mentioned in a comment above I found the issue in other parts of my code. I couldn’t find a way to resolve the issue.

@karl.sjostrand,

I think it works OK on Aspose.Slides part as it correctly saves the PPSX stream. The issue might be with Response object part. Anyways, could you please try to end the Response by adding the line at the end:
e.g.,

....
await ms.CopyToAsync(http.Response.Body);
await http.Response.Body.FlushAsync();
http.Response.End();

If you are still unable to get it to work, we can look into it, so as requested earlier, please share a standalone sample VS.NET application (including the complete source code without any compilation errors) along with the presentation file (if applicable). Please zip the project and attach it here, excluding the Aspose.Slides.Dll to keep the archive size minimal.