-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
47 lines (39 loc) · 1.89 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
namespace word_processing_hyphenation
{
class Program
{
static void Main(string[] args)
{
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
//Register the created service implementation
wordProcessor.LoadDocument("Multimodal.docx");
//Load embedded dictionaries
var openOfficePatternStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("word_processing_hyphenation.hyphen.dic");
var customDictionaryStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("word_processing_hyphenation.hyphen_exc.dic");
//Create dictionary objects
OpenOfficeHyphenationDictionary hyphenationDictionary = new OpenOfficeHyphenationDictionary(openOfficePatternStream, new System.Globalization.CultureInfo("EN-US"));
CustomHyphenationDictionary exceptionsDictionary = new CustomHyphenationDictionary(customDictionaryStream, new System.Globalization.CultureInfo("EN-US"));
//Add them to the word processor's collection
wordProcessor.HyphenationDictionaries.Add(hyphenationDictionary);
wordProcessor.HyphenationDictionaries.Add(exceptionsDictionary);
//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("Result.pdf");
}
}
}