Opening up a PowerPoint file using Interop hangs on one users computer

770 Views Asked by At

I'm at a little loss on this one.

I have a C# application that creates PowerPoint presentations from a template file. This application works for all but one user.

On this users computer the application used to run fine but now hangs when trying to open up the PowerPoint file. The progress bar displays "Importing Template" so I know it's between ReportProgress("Importing Template"); and ReportProgress("Expanding Template");

using ppt = Microsoft.Office.Interop.PowerPoint;

private bool ExpandTemplateAndSave(string FileName)
{
   bool status = true;

   string path = Directory.GetCurrentDirectory() + "\\Resources\\pptTemplate.pptx";


   //Back up file is hard coded on server
   if (!File.Exists(path))
   {
      path = @"[Valid Server Path]\Test Build\pptTemplate.pptx";
   }

   ReportProgress("Importing Template");

   ppt.Application app = new ppt.Application();

   ppt.Presentation pres = app.Presentations.Open(path, MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);

   ReportProgress("Expanding Template");
}

What could be causing this to hang?

1

There are 1 best solutions below

0
On

You need to pass a local file path to the Presentations.Open method which opens the specified presentation. Most Office applications can deal with a local file path only, so it seems PowerPoint can have the same limitation.

Another possible pitfall is network access. Firewalls and antivirus software may block applications from accessing remote endpoints.