Products Technologies Demo Docs Blog Support Company

TX Spell .NET 3.0: Loading Dictionaries from Embedded Resources

TX Spell .NET 3.0 provides a new function to load dictionaries from memory. This allows you to add dictionaries to the DictionaryCollection from embedded resources or shared databases. The OpenOfficeDictionary class got a new constructor accepting a dictionary (.dic) and an affix (.aff) file as a string array. The following code shows how to load a dictionary from embedded resources: List dic = new List(); List aff = new List(); Assembly _assembly; StreamReader _textStreamReader; _assembly =…

TX Spell .NET 3.0: Loading Dictionaries from Embedded Resources
TX Spell .NET 3.0

TX Spell .NET 3.0 provides a new function to load dictionaries from memory. This allows you to add dictionaries to the DictionaryCollection from embedded resources or shared databases.

The OpenOfficeDictionary class got a new constructor accepting a dictionary (.dic) and an affix (.aff) file as a string array. The following code shows how to load a dictionary from embedded resources:

List<string> dic = new List<string>();
List<string> aff = new List<string>();

Assembly _assembly;
StreamReader _textStreamReader;

_assembly = Assembly.GetExecutingAssembly();
string line;

_textStreamReader = new StreamReader(
    _assembly.GetManifestResourceStream("tx_spell_open_dict_resource.en_US.dic"));
while ((line = _textStreamReader.ReadLine()) != null)
{
    dic.Add(line);
}

_textStreamReader = new StreamReader(
    _assembly.GetManifestResourceStream("tx_spell_open_dict_resource.en_US.aff"));
while ((line = _textStreamReader.ReadLine()) != null)
{
    aff.Add(line);
}

OpenOfficeDictionary dic_enUS = new OpenOfficeDictionary(
    dic.ToArray(), aff.ToArray(), new CultureInfo("en-US"));
txSpellChecker1.Dictionaries.Add(dic_enUS);

This is just another great idea of TX Spell .NET 3.0. Find out more about the new release in the What's New section.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Related Posts

Windows FormsWPF.NET

Create a Table of Contents in Windows Forms using C#

This article explains how to create a table of contents in Windows Forms using the ribbon or programmatically. Creating a table of contents is required to organize large documents.


ASP.NETWindows FormsWPF

Official TX Text Control .NET Sample Applications Are Now Hosted on GitHub

This article gives a quick overview of the new repositories, their structure and our plans for the future.


ASP.NETJavaScriptDocument Editor

Detect Toggle Button Changes Using a MutationObserver

This article shows how to detect changes of toggle buttons in the ribbon of the web editor using a MutationObserver. The state of a toggle button in the ribbon visualizes the state of a certain…


Windows FormsList.NET

Two Ways to Restart Numbered Lists in TX Text Control

In TX Text Control, numbered lists are continued by default and need to be reset when required. There is more than one way if you want to restart numbered lists in a document. In this article, two…


Windows FormsSampleShortcuts

Zoom Tricks: Disabling CTRL + MOUSE WHEEL and More

This article shows how to disable CTRL + MOUSE WHEEL, implement zooming with keyboard and reset the zoom factor to its default value.