This is my code that modifies a PowerPoint presentation, saves it as a new file, closes it, then tries to open that file.
var doc = PresentationDocument.Open(@"d:\temp.pptx", true);
//... proccess presentation
doc.SaveAs(@"d:\temp2.pptx");
doc.Close();
var doc2 = PresentationDocument.Open(@"d:\temp2.pptx", false);
doc2.Close();
I can not understand why run-time throws an exception:
The process cannot access the file 'x' because it is being used by another process.
doc
is object of PresentationDocument which unfortunately has not some method to stream save. – Ralf