0

I have a PowerPoint Add in that create, modify and save presentations. Specific options for the opened presentation should be stored in this presentation file (.pptx) using Open XML, when i try to do this I get an IOException:

**System.IO.IOException : The process cannot access the file 'test.pptx' because it is being used by another process.**

This is a snippet from the code:

**

using (PresentationDocument pptPackage = PresentationDocument.Open(fileName, true))
{
// add options to pptx file.
}

**

Thank you.

Khalil_B
  • 59
  • 7

1 Answers1

0

If you need just to read opened presentation using Open XML you can do it this way:

using (Stream stream = new FileStream(_fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (PresentationDocument pptPackage = PresentationDocument.Open(stream, false))
{
    // read pptx file.
}

But you can't change presentation this way.

anzood
  • 51
  • 1
  • 3