Skip to main content
All docs
V25.1
  • DevExpress v25.1 Update — Your Feedback Matters

    Our What's New in v25.1 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

    Take the survey Not interested

    ParagraphBorders Interface

    Contains paragraph border settings.

    Namespace: DevExpress.XtraRichEdit.API.Native

    Assembly: DevExpress.RichEdit.v25.1.Core.dll

    NuGet Package: DevExpress.RichEdit.Core

    #Declaration

    [ComVisible(true)]
    public interface ParagraphBorders

    The following members return ParagraphBorders objects:

    #Example

    The following code snippet sets borders for multiple paragraphs:

    word processing paragraph borders

    using DevExpress.XtraRichEdit;
    using DevExpress.XtraRichEdit.API.Native;
    using System.Drawing;
    
    using (var wordProcessor = new RichEditDocumentServer()) {
        Document document = wordProcessor.Document;
    
        // Start to edit the document.
        document.BeginUpdate();
    
        // Append text to the document.
        document.AppendText(String.Format("Modified Paragraph" + 
            Environment.NewLine + "Normal" + Environment.NewLine + "Normal"));
    
        // Finalize the edit operation.
        document.EndUpdate();
    
        // Obtain a range from the first to the last paragraph
        Paragraph firstParagraph = document.Paragraphs[0];
        Paragraph thirdParagraph = document.Paragraphs[2];
        DocumentRange paragraphRange = 
            document.CreateRange(firstParagraph.Range.Start, thirdParagraph.Range.End.ToInt() - firstParagraph.Range.Start.ToInt());
    
        // Start to edit the paragraph.
        ParagraphProperties pp = document.BeginUpdateParagraphs(paragraphRange);
        SetBorder(pp.Borders.HorizontalBorder);
        SetBorder(pp.Borders.BottomBorder);
        SetBorder(pp.Borders.TopBorder);
        SetBorder(pp.Borders.LeftBorder);
        SetBorder(pp.Borders.RightBorder);
    
        // Finalize the edit operation.
        document.EndUpdateParagraphs(pp);
    }
    
        static void SetBorder(ParagraphBorder border)
        {
            border.LineWidth = 2f;
            border.LineStyle = BorderLineStyle.Thick;
            border.LineColor = Color.SteelBlue;
        }
    
    See Also