I am developing a C # program that creates a PowerPoint presentation. However, I ran into a problem with the following instruction:
Presentation pres = pres_set.Open(path,
Microsoft.Office.Core.MsoTriState.msoFalse,
Microsoft.Office.Core.MsoTriState.msoTrue,
Microsoft.Office.Core.MsoTriState.msoTrue);
This instruction only works sometimes. If this is not the case, it throws an exception with the message "PowerPoint cannot open the file." When I manually open the template file, close it and run the function again, most of the time it will execute correctly.
I used the Microsoft PowerPoint 14.0 and Microsoft Powerpoint 12.0 libraries, but both have the same problem.
Is there any way to avoid this strange problem?
source
share