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");
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            richEditControl1.LoadDocument("Multimodal.docx");
            var openOfficePatternStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DXRichEdit.hyph_en_US.dic");
            var customDictionaryStream  = Assembly.GetExecutingAssembly().GetManifestResourceStream("DXRichEdit.hyphen_exc.dic");

            //Create dictionary objects
            OpenOfficeHyphenationDictionary hyphenationDictionary = new OpenOfficeHyphenationDictionary(openOfficePatternStream, new CultureInfo("EN-US"));
            CustomHyphenationDictionary     exceptionsDictionary  = new CustomHyphenationDictionary(customDictionaryStream, new CultureInfo("EN-US"));

            //Add them to the word processor's collection
            richEditControl1.HyphenationDictionaries.Add(hyphenationDictionary);
            richEditControl1.HyphenationDictionaries.Add(exceptionsDictionary);

            richEditControl1.Document.Hyphenation = true;
        }
        private void HyphenateDocument(Document document)
        {
            //Load embedded dictionaries
            var openOfficePatternStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("XtraRichEdit.hyph_en_US.dic");
            var customDictionaryStream  = Assembly.GetExecutingAssembly().GetManifestResourceStream("XtraRichEdit.hyphen_exc.dic");


            //Create dictionary objects
            OpenOfficeHyphenationDictionary hyphenationDictionary = new OpenOfficeHyphenationDictionary(openOfficePatternStream, new CultureInfo("EN-US"));
            CustomHyphenationDictionary     exceptionsDictionary  = new CustomHyphenationDictionary(customDictionaryStream, new CultureInfo("EN-US"));

            //Add them to the word processor's collection
            richEditControl.HyphenationDictionaries.Add(hyphenationDictionary);
            richEditControl.HyphenationDictionaries.Add(exceptionsDictionary);

            //Enable automatic hyphenation
            document.Hyphenation = true;
        }