As a side project I have been working on a Microsoft Word document concordance generator. The goal of the application is to loop through each word of all documents in a given directory and compose a concordance list. Obviously there is more to it, but that should give you the gist of it. I am using the Microsoft Word API and .Net 2.0 to implement the solution. The Word API is great because it pretty much exposes everything that you can normally do in Word but through an API. Everything has good and bad parts, that was the good part, the bad part is the speed. The API is slow, which is understandable especially considering that I have a special layer between (the .Net wrapper) so I have had to come up with alternatives. One of the problems that I encountered right away was the “Insufficient Memory Error”. The problem with this was the actual physical dialog box asking the user to confirm that they want to continue.

Word has insufficient memory. You will not be able to undo this action once it is completed. Do you want to continue?

To get around this I had to clear out the undo history manually, at regular intervals. To do this you have to call the ClearUndo function

wdDoc.ClearUndo()   // wdDoc is the Word.Document object

This was my first .Net 2.0 project and I was amazed the data structures that .Net 2.0 provides; things like the templated list and dictionaries. Additionally, I really enjoyed how easy it was to created a threaded application where the thread can report back on it’s progress. Threading is a whole beast that probably deserves an article. If you are interested check out the BackgroundWorker class.

Back to blog...