Skip to main content
All docs
V25.2
  • SpellCheckOptions.FileProvider Property

    Specifies a file provider that accesses dictionary files.

    Namespace: DevExpress.Blazor.RichEdit.SpellCheck

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

    NuGet Package: DevExpress.Blazor.RichEdit

    Declaration

    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:

    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 additional information: Spell Check.

    The following code snippet (auto-collected from DevExpress Examples) contains a reference to the FileProvider property.

    Note

    The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

    See Also