Saving a PowerPoint Presentation in PPTX in C# Causes Broken Background Images

hi Andrey

When i think this library is finally really good, a surprise takes all my trust away from that product.

Please fix this as soon as possible ?!

Thanks.

input:

output:

code:

var ppt_out_no_ext = Path.Combine(ppt_out_dir, Path.GetFileNameWithoutExtension(ppt_path));
Aspose.Slides.Export.SaveFormat ppt_file_aspose_format = GetPresFormat(ppt_path);
var ppt_out = ppt_out_no_ext + “.” +ppt_file_aspose_format.ToString().ToLower();
Aspose.Slides.LoadOptions _loadOptions = new Aspose.Slides.LoadOptions()
{
    BlobManagementOptions = new BlobManagementOptions
    {
        PresentationLockingBehavior = PresentationLockingBehavior.KeepLocked,
        IsTemporaryFilesAllowed = true,
        MaxBlobsBytesInMemory = 100 * 1024 * 1024,
    }
};
using (var stream = new FileStream(ppt_path, FileMode.Open))
{
    Aspose.Slides.Presentation pres = null;
    try
    {
        pres = new Aspose.Slides.Presentation(stream, _loadOptions);
        pres.Save(ppt_out, Aspose.Slides.Export.SaveFormat.Pptx);
        pres.Dispose();
    }
    catch (Exception ex)
    {
        WriteLog(ex.Message, LogType.error);
    }
}

@pcaillol
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESNET-43916

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

I was able to reproduce your issue, and it’s related to PresentationLockingBehavior.KeepLocked. To avoid this issue and as temporal workaround I recommend to use 1 of the following alternatives:

  1. Avoid set the PresentationLockingBehavior with the value PresentationLockingBehavior.KeepLocked (you can just remove this line of code)
  2. Copy your presentation in a new one and save it:
LoadOptions loadOptions = new LoadOptions()
{
    BlobManagementOptions = new BlobManagementOptions
    {
        PresentationLockingBehavior = PresentationLockingBehavior.KeepLocked,
        IsTemporaryFilesAllowed = true,
        MaxBlobsBytesInMemory = 100 * 1024 * 1024,
    }
};

Presentation pre = new Presentation();

using (var stream = new FileStream("C:\\Temp\\slides\\input.pptx", FileMode.Open))
{
    var presentation = new Presentation(stream, loadOptions);

    foreach (var slide in presentation.Slides)
    {
        pre.Slides.AddClone(slide);
    }

    if (pre.Slides.Count > 1)
        pre.Slides[0].Remove();

    pre.Save("C:\\Temp\\slides\\output1.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
} 

This is not relevant explanation for a user and PresentationLockingBehavior.KeepLocked is made for handling huge files.

This shall work indistinctly so i will wait for the fix !

thanks

@pcaillol I know that this is inconvenient if you are dealing with huge files, but until the issue is analyzed, I cannot speculate on the cause of it.
Thank you for your understanding.

The issues you found earlier (filed as SLIDESNET-43916) have been fixed in Aspose.Slides for .NET 23.6 (ZIP, MSI).
You can check all fixes on the Release Notes page.
You can also find the latest version of our library on the Product Download page.