0
votes

We've got a C# application, written in Visual Studio 2017, which automates the data entry for a series of embedded Excel charts in a PowerPoint application. Lately, seemingly out of the blue, the code freezes at certain points when it is interacting with the Excel object. In particular, it seems this line is a problem: Excel.Workbook xlWorkbook = (Excel.Workbook)shape.OLEFormat.Object;

It will stick there and stay there for hours. It doesn't throw an error.

I've tried uninstalling and reinstalling Office fresh. Doesn't help. I'm stumped. I'm just looking for any kind of suggestion of approaches to the problem, what to look at, etc.

Edit: I supposed I should provide a little more information. In this process, we open up two Powerpoints. The first is called a "master", and contains a "library" of slides with charts of different configurations on them. The application, based on the values of certain field in records retrieved from a db, copies slides from the "master" into the new presentation, then connects to the charts, retrieves the data for them from the db, and fills them in. These new presentations can have anywhere from 100 to 300 slides in them, and many of them are copied from the exact same slide in the "master". In other words, multiple copies of the same slide and chart are filled in during the creation of a new presentation. And all of this happens over and over; the application may create hundreds of these new presentations in a session. So, there are many many times when there is no problem connecting to a given chart. But then, all of a sudden, 20 presentations in, and a 100 and some charts into a presentation, bam. Other times, it happens almost immediately, during the first few slides in the first presentation. And, this has all been running fine for a few months. Now, all of a sudden, we've got a problem.

1

1 Answers

0
votes

The issue you're having is because of the embedded excel has something wrong with it when the person to made the file created it. The reason you're not getting an error is that power point is internally handling it. The way to troubleshoot the issue is to rename the .pptx file to be a .zip file and open the resources folder inside the zip folder. Inside of there will be the actual excel sheet that is embedded. If you try to run your code directly against that excel file you'll be able to see the actual exception that is occurring. A shorter solution would be to delete the excel file that is embedded from your template file and then put in a new test file to see if that solves your problem. If that does solve your problem then the next step would be to manually input the data (not copy and paste) into the new sheet that you embedded.