I want to use Hunspell with WPF, but initialization seems to fail.

Asked 5 months ago, Updated 5 months ago, 17 views

WPF uses HunSpell wrapper class NHunspellWrapper.

private void Window_Loaded (object sender, RoutedEventArgse)
   // spelling check
   varhunspell=new NHunspellWrapper();

Called by

publicNHunspellWrapper(): this("en_US.aff", "en_US.dic", null, new SpellingFormBasic())


/// <param name="affFile">"en_us.aff"</param>
/// <param name="dicFile">"en_us.dic"</param>
public NHunspellWrapper(string affFile, stringdicFile, ISpellingControl textEditor, ISpellingWindowspellForm)
        hunspell=new Hunspell(affFile,dicFile);
        varchk=hunspell.Spell("with");<-false returns

Hunspell is not null, but I feel like I can't read the dictionary file or initialization has failed.
There's no basis, but...

I couldn't find this sample of Hunspell when I looked for something like WinForm and WPF.


It seems that the HunspellWrapper component spellingWorker is made in WinForm, but not in WPF.

How do I use Hunspell components in WPF?

Environment Windows 10 VS 2015 C#WPF

c# wpf

2022-09-30 13:56

1 Answers

Why not replace it with NHunspellSpellcheck-Hyphen-Thesaurus standard SpellCheck

It seems that this will work.


From the above site

using(var hunspell=new Hunspell("en_us.aff", "en_us.dic")))

    string [ ] lines = System.IO.File.ReadAllLines("CustomWords-en_US.txt");
    foreach (var line in lines)

It seems to work in the form of the directly.

Thank you.

2022-09-30 13:56

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.