Free Support Forum -

File being wiped clean after failure

When attempting to save a .ppt file, aspose fails due to lacking a password. After failure the file has all data within erased. Why is the file being wiped clean?
Problem Document: (2.7 MB)
Aspose.Slides Version: Version=


            var saveFormat = saveFormatProvider.Get(filePath);

            using (var presentation = new Aspose.Slides.Presentation(filePath))
                foreach (var variable in environmentVariables)
                    presentation.DocumentProperties.SetCustomPropertyValue(variable.SearchText, variable.ReplacementValue);
                presentation.Save(filePath, saveFormat);
Exception message: Presentation is encrypted but LoadOptions.Password is null. Load presentation with right password or remove presentation encryption.
Exception stack trace:
   at Aspose.Slides.   .()
   at Aspose.Slides.   .(Stream , ISaveOptions )
   at Aspose.Slides.Presentation.Save(Stream stream, SaveFormat format, ISaveOptions options)
   at Aspose.Slides.Presentation.Save(String fname, SaveFormat format)


I have osberved your comments. Can you please visit this documentation article. This article will help you how to load password protected presentation with Aspose.Slides. Please share feedback with us if there is still an issue.

1 Like

Thank you for the speedy reply.

Is it strange that the save method would wipe it completely clean? I cannot believe that on failure due to password protection the normal save process response is to leave the file in an unusable state.


I have observed the presentation file shared by you and like to share even PowerPoint does not allow editing or saving a write protected presentation opening only in read only mode. You can only view the read only presentation. Aspose.Slides shall generate a valid presentation only when you will provide write protection password while loading the presentation. Only then the saved presentation will be valid. This is neither an issue nor a limitation in API.

Thanks for clarifying. Will be using the save method in a more careful manner from here on.

In doing further research, is there a way to set the SaveOptions to prevent the powerpoint from saving a password protected file? Can’t seem to find the inner-workings of saveoptions on Aspose.Slides


I suggest you to please visit this documentation link for possible presentation save options on your end which include saving in write protected and read only mode.