Back to Devexpress

Hyphenation

wpf-401189-controls-and-libraries-rich-text-editor-hyphenation.md

latest3.7 KB
Original Source

Hyphenation

  • Oct 15, 2025
  • 3 minutes to read

The RichEditControl can enable or suppress word hyphenation at line breaks.

When you load a document, the following scenarios are possible:

  • If the document contains soft hyphens, RichEditControl preserves them.
  • If the document has automatic hyphenation enabled, the DXRichEdit uses the currently linked hyphenation dictionaries to hyphenate the text. Note that the document layout may change.

Add a Hyphenation Dictionary

Link a dictionary that specifies hyphenation rules. The RichEditControl.HyphenationDictionaries property provides access to the dictionary collection. You can use two dictionary types:

  1. OpenOfficeHyphenationDictionary

  2. CustomHyphenationDictionary

Dictionary Culture

The RichEditControl uses dictionaries that match the document’s culture. You can specify the dictionary’s culture in the object constructor. If the culture is not specified, the dictionary’s culture is set to the machine’s current culture.

Hyphenate Text

Use the following properties to hyphenate document text:

PropertyDescription
Document.HyphenationSpecifies whether to hyphenate text automatically. If dictionaries are not provided, the property has no effect.
Document.HyphenateCapsGets or sets whether to hyphenate words in CAPS.
Paragraph.SuppressHyphenationSpecifies whether to limit hyphenation to a specific paragraph.

The code sample below shows how to enable hyphenation and export a document to the PDF format.

csharp
//Load a document
richEditControl.LoadDocument("Grimm.docx");

//Specify hyphenation settings
richEditControl.Document.Hyphenation = true;
richEditControl.Document.HyphenateCaps = true;

//Export the result to the PDF format
richEditControl.ExportToPdf("Result.pdf");

//Open the result
Process.Start("Result.pdf");
vb
'Load a Document
richEditControl.LoadDocument("Grimm.docx")

'Specify hyphenation settings
richEditControl.Document.Hyphenation = True
richEditControl.Document.HyphenateCaps = True

'Export the result to the PDF format
richEditControl.ExportToPdf("Result.pdf")

'Open the result
Process.Start("Result.pdf")

Hyphenation in the User Interface

End user can press Ctrl+- to insert soft hyphens where necessary. Use the Hyphenation drop-down list on the Page Layout ribbon tab to enable or suppress automatic hyphenation, and specify additional hyphenation options. If dictionaries are not provided, the list is disabled.

The Hyphenation Dialog allows you to enable automatic hyphenation and specify whether to hyphenate words in CAPS.

Use the Paragraph Dialog to suppress hyphenation for a specific paragraph. On the Line and Page Breaks tab, check the Don’t Hyphenate item.