Back to Devexpress

Hyphenation

officefileapi-401149-word-processing-document-api-hyphenation.md

latest2.9 KB
Original Source

Hyphenation

  • Oct 13, 2025
  • 3 minutes to read

RichEditDocumentServer 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, RichEditDocumentServer preserves them.
  • If the document has automatic hyphenation enabled, the Word Processing Document API 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 RichEditDocumentServer.HyphenationDictionaries property provides access to the dictionary collection. You can use two dictionary types:

  1. OpenOfficeHyphenationDictionary

  2. CustomHyphenationDictionary

Dictionary Culture

The RichEditDocumentServer 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 following code snippet enables hyphenation and export a document to the PDF format.

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

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

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

//Open the result
Process.Start(new ProcessStartInfo("Result.pdf") { UseShellExecute = true });
vb
'Load a Document
wordProcessor.LoadDocument("Grimm.docx")

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

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

'Open the result
Process.Start(New ProcessStartInfo("Result.pdf") With {.UseShellExecute = True})