Hello, I currently have a class for exporting to excel certain forms/grids for which the base excel export is disabled (such as the Period grid on Net Requirements). I am calling application.quit() on my SysExcelApplication object, which is closing out the workbook and the open process (under 'Apps' in Task Manager). Unfortunately it is leaving open a background excel process taking up ~36MB of memory. Not a big deal on its own, but every time the class is run it leaves another such background process, which could have more serious performance concerns. Oddly if I start excel normally from windows and close it, it never opens a background process.
Is there something else I should be doing to close out the process other than calling the quit() method? Walking through the debugger doesn't help much because the quit method code just calls itself and the debugger can't go into it (I am assuming it is calling the method on the excel COM object or something that the ax debugger doesn't have access to).
This is my code for reference:
protected void exportToExcel(FormDataSource _formDataSource) { SysExcelApplication excelApplication = SysExcelApplication::construct(); SysExcelWorkbooks workBooks = excelApplication.workbooks(); SysExcelWorkbook workBook = workBooks.add(); SysExcelWorkSheets workSheets = workbook.worksheets(); SysExcelWorkSheet workSheet = workSheets.add(); Filename filename; #Macrolib.Excel; excelApplication.visible(false); filename = this.getFilename(); if (!filename) { excelApplication.quit(); return; } this.insertData(workSheet, _formDataSource); excelApplication.displayAlerts(false); workBook.saveAs(filename, #xlWorkbookDefault); excelApplication.quit(); }