Reputation: 1166
I am working on a license management type application that copies a password protected zip file to the applications root. The user clicks a button "Open Presentation" and the zipped file is extracted into the root folder and then I use the Office interop to open the file in Powerpoint. At this point to my surprise I am able to delete the extracted file that is currently open in the Powerpoint application. I had assumed that trying to delete the file would fail as the file is still open in Powerpoint.
Why is it allowing me to delete the file? Is the file somehow copied to a temp folder and then opened in PowerPoint?
Can I move forward with the application relying on this ability to delete the file as soon as it is opened in Powerpoint? This would be optimal because it helps insure that the file cannot be copied(I am also using the xml to stop "Save As" and "Save" from appearing int Powerpoint).
Upvotes: 1
Views: 122
Reputation: 4336
Even if this specific version of PowerPoint doesn't fail when this specific file is deleted while it's open, I wouldn't rely on that behavior for future (or past) versions of Powerpoint, nor for other (larger? containing OLE links?) files. Remember that everything you're working with is basically documented by "reference implementation".
To be frank, your application sounds like an annoying technical solution to a social problem.
Upvotes: 0
Reputation: 9481
Many applications do not keep the file open after they loaded it into memory. Possibly this is the case with powerpoint as well. Also, some operating systems let you delete open files unless they are specifically locked. Many unix systems exhibit such behavior.
As for you purposes, what would stop the user to just save the power point file into different location?
Also, in the future power point might keep the file open after they read into memory
Upvotes: 3