static void SplitDocument(RichEditDocumentServer wordProcessor)
 {
     #region #SplitDocument
     wordProcessor.LoadDocument("Documents\\Grimm.docx", DocumentFormat.OpenXml);
     //Split a document per page
     int pageCount = wordProcessor.DocumentLayout.GetPageCount();
     for (int i = 0; i < pageCount; i++)
     {
         DevExpress.XtraRichEdit.API.Layout.LayoutPage    layoutPage    = wordProcessor.DocumentLayout.GetPage(i);
         DevExpress.XtraRichEdit.API.Native.DocumentRange mainBodyRange = wordProcessor.Document.CreateRange(layoutPage.MainContentRange.Start, layoutPage.MainContentRange.Length);
         using (RichEditDocumentServer tempServer = new RichEditDocumentServer())
         {
             tempServer.Document.AppendDocumentContent(mainBodyRange);
             //Delete last empty paragraph
             tempServer.Document.Delete(tempServer.Document.Paragraphs.First().Range);
             //Save the result
             string fileName = String.Format("doc{0}.rtf", i);
             tempServer.SaveDocument(fileName, DocumentFormat.Rtf);
         }
     }
     System.Diagnostics.Process.Start("explorer.exe", "/select," + "doc0.rtf");
     #endregion #SplitDocument
 }
 protected override void VisitPage(DevExpress.XtraRichEdit.API.Layout.LayoutPage page)
 {
     System.Diagnostics.Debug.WriteLine("Visiting page {0}", page.Index + 1);
     base.VisitPage(page);
 }