I have written a method in IronPython that writes to a PowerPoint chart using the Interop.PowerPoint library. The method works fine, however it encounters performance issues when dealing with a PPT file with a lot of charts. I have determined that the cause for this is due to the fact that each time I write to a chart, an instance of Excel is opened, but never closed/released (thereby taking up memory resources). I have not been able to figure out how to close/release the instance of Excel. Can you please help?
Here's the relevant code:
#edit chart values
my_chart = shp.Chart
my_chart_data = my_chart.ChartData
my_chart_wb = my_chart_data.Workbook
my_chart_ws = my_chart_wb.Worksheets(1)
my_chart_ws.Range("B2").Value = record[shp.Name]
#close Excel (LINE EXECUTES, BUT EXCEL REMAINS OPEN IN THE TASK MANAGER)
my_chart_wb.Close
my_chart_wb.Application.Quit()