void richEdit_Loaded(object sender, System.Windows.RoutedEventArgs e) { richEdit.SpellChecker = spellChecker; richEdit.Options.AutoCorrect.CorrectTwoInitialCapitals = true; richEdit.Options.AutoCorrect.UseSpellCheckerSuggestions = true; IAutoCorrectService service = richEdit.GetService <IAutoCorrectService>(); if (service != null) { AutoCorrectReplaceInfoCollection replaceTable = new AutoCorrectReplaceInfoCollection(); replaceTable.Add("(C)", "©"); replaceTable.Add(new AutoCorrectReplaceInfo(":)", OfficeImage.CreateImage(GetType().Assembly.GetManifestResourceStream("RichEditDemo.smile.png")))); replaceTable.Add("pctus", "Please do not hesitate to contact us again in case of any further questions."); replaceTable.Add("wnwd", "well-nourished, well-developed"); service.SetReplaceTable(replaceTable); } }
private AutoCorrectReplaceInfoCollection LoadAbbrevs(string path) { AutoCorrectReplaceInfoCollection coll = new AutoCorrectReplaceInfoCollection(); string aLine = ""; AutoCorrectReplaceInfo acrInfoIm = new AutoCorrectReplaceInfo(":-)", CreateImageFromResx("smile.png")); coll.Add(acrInfoIm); if (File.Exists(path)) { StreamReader sr = new StreamReader(path); while (!(sr.EndOfStream)) { aLine = sr.ReadLine(); if (aLine != "START") { continue; } while (!(sr.EndOfStream)) { aLine = sr.ReadLine(); aLine = aLine.Trim(); string[] words = aLine.Split('='); if (words.Length == 2) { AutoCorrectReplaceInfo acrInfo = new AutoCorrectReplaceInfo(words[0], words[1]); coll.Add(acrInfo); } } } sr.Close(); } return(coll); }