I have written the following code under assumption that Excel will die with the monkey:
Excel ExcelMonkey {Personal Stable Excel.Application xl = New Excel.Application (); Public Stable Bull Parse (string filename) {if (filename.Contains ("foo")) {var workbook = xl.Workbooks.Open (filename); Var Sheet = Workbook. Worksheets.get_item (1); // do stuff returns true; } return false; }}
How can I ensure that it does? Do I have to separate the workbook
and sheet
?
I have to fill the Excel for the life of the program, this is a major performance improvement
< Blockquote>
Do I need to release workbooks and sheets separately?
Yes, either the built-in Excel application will keep the object alive.
How do I ensure that it does?
This will do, but make sure that you do not use the context of the object after this.
Comments
Post a Comment