Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

SpellCheckOptions.FileProvider Property

Specifies a file provider that accesses dictionary files.

Namespace: DevExpress.Blazor.RichEdit.SpellCheck

Assembly: DevExpress.Blazor.RichEdit.v24.2.dll

NuGet Package: DevExpress.Blazor.RichEdit

#Declaration

C#
public IFileProvider FileProvider { get; set; }

#Property Value

Type Description
IFileProvider

A file provider.

#Remarks

The Dictionaries property contains all added dictionaries. A dictionary can include several files. For instance, an ISpell dictionary includes a base words file and affix file.

Assign a file provider to the FileProvider property so that the service can access dictionary files. The FileNotFoundException error occurs if you do not set the file provider, but add a dictionary.

The following code snippet sets a file provider:

C#
public void ConfigureServices(IServiceCollection services) {
    services.AddDevExpressBlazor().AddSpellCheck(opts => {
        opts.FileProvider = new PhysicalFileProvider(
            Path.Combine(Directory.GetCurrentDirectory(), "Data", "Dictionaries")
        );
        opts.MaxSuggestionCount = 7;
        opts.Dictionaries.Add(new Dictionary {
            DictionaryPath = "CustomEnglish.dic",
            AlphabetPath = "EnglishAlphabet.txt",
            Culture = "en-US"
        });
        opts.AddToDictionaryAction = (word, culture) => {
            switch (culture.Name) {
                case "en-US":
                    string path = opts.FileProvider.GetFileInfo("CustomEnglish.dic").PhysicalPath;
                    File.AppendAllText(path, word);
                    break;
                default:
                    break;
            };
        };
    });
}

Refer to the following topic for more information: Spell Check.

See Also