Free Support Forum - aspose.com

Unable to Delete a Presenation - Urgent help required!

Having created a new Presentation object using an existing .PPT file i.e. presSource = New Presentation(strTempFilename) we then need to be able to delete this presentation accordingly:

If System.IO.File.Exists(strTempFilename) = True Then

System.IO.File.Delete(strTempFilename)

End If

When attempting to delete the file however, the following exception is encountered: "The process cannot access the file "filename.ppt" because it is being used by another process."

Please would you advise on how the Aspose Presentation object can release the handle to the file to enable to deletion to work? I have tried setting the Presentation object to Nothing (null) prior to issuing the delete to no avail.

Thanks in advance,

Allan Ashton (aashton@uk.ey.com)

Use stream instead of file name when open presentation and close it before file deleting.

Might I suggest the addition of a close() method to the Presentation
class? Even better, it could implement IDisposable which would allow
for the following construct:

using (Presentation pres = new Presentation(filename))
{
// Do cool stuff here
}