This project has moved. For the latest updates, please go here.

Excel slow to close

Dec 22, 2016 at 4:27 PM
I am new to NetOffice and I am using it to create a robust application using Excel as the UI with lots of work begin done behind the scenes.

I generate reports so lots of Excel model access. At the moment I have not optimized the reading or ranges and am reading rows and cells of rows. It is currently slow but I haven't finished the application and waiting to optimize at the end.

I work with a lot of tables. So list rows and list columns get used alot.

So the problem:
When I close Excel it hangs for a long time trying to close. Sometimes it doesn't close with the CPU spiked.

I do not have any on close code. I assume it is the clean up process. The disposing of all the COM objects. I have read the article on how NetOffice handles COM Objects. I'll read it again though. I even tried adding some dispose calls to try to minimize the amount of objects needing disposal at the end; however, I have run into problems with objects being disposed of while I still need them. (my design issue).

What is the recommend pattern for usage, disposal and clean up?
Dec 24, 2016 at 2:16 AM
How many proxies you have at the end?
(<=1000 is the recomended maximum based on my experience.)

Jan 3 at 3:49 PM
Oh I have way, way, way more than that.

I have not been worrying about disposing and I pass ranges around. Is there a particular pattern you use for accessing the Excel Model?

What I am doing at the moment is using Excel like a database. One sheet contains data and I have created gui's that manipulate the data in an Excel Table.
So I get the list object, get a row, parse it into an object. Manipulate the object and push the changes back into the row. One cell at a time ( I know changing this into an array will solve some problems).

But I do alot of grab a list row, read / write / push back.

I know that is not a lot of information but any direction would be great!

Jan 12 at 10:45 AM
yeah you should not be passing back one cell at a time,

but this should not case the slowness at close down?