tags:

views:

135

answers:

0

I am unable to clear my custom dictionaries. I can add a custom dictionary, set an active custom dictionary and change languages, but can't seem to clear them. The only way to do this is to actually open Word 2007 and go to the spelling options and remove the custom dictionaries. But I need to be able to do this through C#. This is what I am using when I try to clear the custom dictionaries.

using Word = Microsoft.Office.Interop.Word; 
private static Word._Application myApp = new Word.Application();
myApp.CustomDictionaries.ClearAll();
myApp.Visible = false;
myApp.ShowWindowsInTaskbar = false;
object optional = Missing.Value;
object falseValue = false;
myDoc = myApp.Documents.Add( ref optional, ref optional, ref optional, ref falseValue );
myPara = myDoc.Content.Paragraphs.Add( ref optional );
myApp.CustomDictionaries.ClearAll();

According to MSDN when I use ClearAll() the CustomDictionaries.Count should be 0. But it never is. I run into problems when I reach the maximum of 10 custom dictionaries. Any suggestions?

Thank you