Beispiel #1
0
        public DictionaryData(Excel.Application excelObj)
        {
            this.excelObj = excelObj;
            Groups        = new List <string>();
            TrieRoot      = new TrieNode();
            foreach (Excel.Worksheet sheet in excelObj.Sheets)
            {
                Excel.Range cells = sheet.UsedRange;
                Groups.Add(sheet.Name);
                foreach (Excel.Range row in cells.Rows)
                {
                    row.NumberFormat  = "@";
                    Object[,] thisrow = row.Value2;

                    WordData newWord = new WordData();
                    try
                    {
                        newWord.word = thisrow[1, 1] as string;
                        if (newWord.word == "")
                        {
                            continue;
                        }
                        TrieRoot.AddWord(newWord); // Add the word here because a word may have only the name, without definition or type.
                        newWord.Group      = sheet.Name;
                        newWord.definition = thisrow[1, 2] as string;
                        newWord.type       = TranslationPane.getTypeByString(thisrow[1, 3] as string);
                    }
                    catch (Exception e) { }
                }
                //dictionary.Add(myGroup);
            }


            //Now we are going to make the trie for quick reference
        }
        public void LoadTranslatePane()
        {
            if (translatePane != null)
            {
                myTip.dictionary = dict;
                this.CustomTaskPanes.Remove(translatePane);
            }

            myTip         = new TranslationPane(dict);
            translatePane = this.CustomTaskPanes.Add(myTip, "translatePane");
            translatePane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionFloating;
            translatePane.Width        = 410;
            translatePane.Height       = 450;
            //translatePane.DockPositionChanged += new EventHandler(translatePane_DockPositionChanged);
        }