static void FormatParagraph(RichEditDocumentServer wordProcessor)
 {
     #region #FormatParagraph
     Document document = wordProcessor.Document;
     document.BeginUpdate();
     document.AppendText("Modified Paragraph\nNormal\nNormal");
     document.EndUpdate();
     DocumentPosition    pos   = document.Range.Start;
     DocumentRange       range = document.CreateRange(pos, 0);
     ParagraphProperties pp    = document.BeginUpdateParagraphs(range);
     // Center paragraph
     pp.Alignment = ParagraphAlignment.Center;
     // Set triple spacing
     pp.LineSpacingType       = ParagraphLineSpacing.Multiple;
     pp.LineSpacingMultiplier = 3;
     // Set left indent at 0.5".
     // Default unit is 1/300 of an inch (a document unit).
     pp.LeftIndent = DevExpress.Office.Utils.Units.InchesToDocumentsF(0.5f);
     // Set tab stop at 1.5"
     TabInfoCollection tbiColl = pp.BeginUpdateTabs(true);
     TabInfo           tbi     = new DevExpress.XtraRichEdit.API.Native.TabInfo();
     tbi.Alignment = TabAlignmentType.Center;
     tbi.Position  = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);
     tbiColl.Add(tbi);
     pp.EndUpdateTabs(tbiColl);
     document.EndUpdateParagraphs(pp);
     #endregion #FormatParagraph
 }
 private void btnFormatParagraph_Click(object sender, EventArgs e)
 {
     #region #formatparagraph
     Document            doc   = richEditControl1.Document;
     DocumentPosition    pos   = doc.Selection.Start;
     DocumentRange       range = doc.CreateRange(pos, 0);
     ParagraphProperties pp    = doc.BeginUpdateParagraphs(range);
     // Center paragraph
     pp.Alignment = ParagraphAlignment.Center;
     // Set triple spacing
     pp.LineSpacingType       = ParagraphLineSpacing.Multiple;
     pp.LineSpacingMultiplier = 3;
     // Set left indent at 0.5".
     // Default unit is 1/300 of an inch (a document unit).
     pp.LeftIndent = Units.InchesToDocumentsF(0.5f);
     // Set tab stop at 1.5"
     TabInfoCollection tbiColl = pp.BeginUpdateTabs(true);
     TabInfo           tbi     = new TabInfo();
     tbi.Alignment = TabAlignmentType.Center;
     tbi.Position  = Units.InchesToDocumentsF(1.5f);
     tbiColl.Add(tbi);
     pp.EndUpdateTabs(tbiColl);
     doc.EndUpdateParagraphs(pp);
     #endregion #formatparagraph
 }
        private void FormatTitleParagraph(Document document)
        {
            #region #FormatTitleParagraph
            //The target range is the first paragraph
            DocumentRange titleParagraph = document.Paragraphs[0].Range;

            //Provide access to the paragraph options
            ParagraphProperties titleParagraphFormatting = document.BeginUpdateParagraphs(titleParagraph);

            //Set the paragraph alignment
            titleParagraphFormatting.Alignment = ParagraphAlignment.Center;

            //Set left indent at 0.5".
            //Default unit is 1/300 of an inch (a document unit).
            titleParagraphFormatting.LeftIndent   = Units.InchesToDocumentsF(0.5f);
            titleParagraphFormatting.SpacingAfter = Units.InchesToDocumentsF(0.3f);

            //Set tab stop at 1.5"
            TabInfoCollection tbiColl = titleParagraphFormatting.BeginUpdateTabs(true);
            TabInfo           tbi     = new TabInfo();
            tbi.Alignment = TabAlignmentType.Center;
            tbi.Position  = Units.InchesToDocumentsF(1.5f);
            tbiColl.Add(tbi);
            titleParagraphFormatting.EndUpdateTabs(tbiColl);

            document.EndUpdateParagraphs(titleParagraphFormatting);
            #endregion #FormatTitleParagraph
        }
Пример #4
0
        static void FormatParagraph(Document document)
        {
            #region #FormatParagraph
            document.BeginUpdate();
            document.AppendText("Modified Paragraph\nNormal\nNormal");
            document.EndUpdate();

            //The target range is the first paragraph
            DocumentPosition pos   = document.Range.Start;
            DocumentRange    range = document.CreateRange(pos, 0);

            // Create and customize an object
            // that sets character formatting for the selected range
            ParagraphProperties pp = document.BeginUpdateParagraphs(range);
            // Center paragraph
            pp.Alignment = ParagraphAlignment.Center;
            // Set triple spacing
            pp.LineSpacingType       = ParagraphLineSpacing.Multiple;
            pp.LineSpacingMultiplier = 3;
            // Set left indent at 0.5".
            // Default unit is 1/300 of an inch (a document unit).
            pp.LeftIndent = DevExpress.Office.Utils.Units.InchesToDocumentsF(0.5f);
            // Set tab stop at 1.5"
            TabInfoCollection tbiColl = pp.BeginUpdateTabs(true);
            TabInfo           tbi     = new DevExpress.XtraRichEdit.API.Native.TabInfo();
            tbi.Alignment = TabAlignmentType.Center;
            tbi.Position  = DevExpress.Office.Utils.Units.InchesToDocumentsF(1.5f);
            tbiColl.Add(tbi);
            pp.EndUpdateTabs(tbiColl);

            //Finalize modifications
            // with this method call
            document.EndUpdateParagraphs(pp);
            #endregion #FormatParagraph
        }