Skip to main content
All docs
V24.2

ParagraphBorder Interface

Implements members used to specify paragraph border parameters.

Namespace: DevExpress.XtraRichEdit.API.Native

Assembly: DevExpress.RichEdit.v24.2.Core.dll

NuGet Package: DevExpress.RichEdit.Core

Declaration

[ComVisible(true)]
public interface ParagraphBorder

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