ParagraphPropertiesBase.Borders Property
Gets the paragraph border properties.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v24.2.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Property Value
Type | Description |
---|---|
ParagraphBorders | An object that contains paragraph border settings. |
Remarks
Use the ParagraphPropertiesBase.Borders
property to obtain properties for each border (left, bottom, top and right).
The HorizontalBorder property retrieves options for a border drawn between paragraphs. Specify this border when you change paragraph properties for multiple paragraphs (that is, when you pass a range that contains two or more paragraphs as the SubDocument.BeginUpdateParagraphs(DocumentRange) method parameter).
The ParagraphBorders.Reset() method resets all paragraph borders.
Example
The following code snippet sets borders for multiple paragraphs:
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;
}