XRRichText.Lines Property
Gets or sets the text lines in the XRRichText control.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v19.1.dll
NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Core
Declaration
Property Value
Type | Description |
---|---|
String[] | An array of String values that contain some text in the XRRichText control. |
Remarks
The Lines property specifies the array of lines displayed by the control. The number of lines coincides with the number of elements in the array. To access all the text at once, you can use the XRRichText.Text property. Text lines are separated by the line feed and carriage return characters (“\r\n”).
You are not able to use the Lines property to change a particular array’s element directly. Instead, you should read the Lines property to get the array, change the required array’s element and then assign the array back to Lines.
Example
The following method demonstrates how to create an XRRichText object, set some of its properties, and then save its contents to a text file.
using System;
using DevExpress.XtraReports.UI;
// ...
public XRRichText CreateXRRichText(){
// Create an XRRichText object.
XRRichText xrRichText1 = new XRRichText();
// Set its height to be calculated automatically,
// and make its borders visible.
xrRichText1.CanGrow = true;
xrRichText1.CanShrink = true;
xrRichText1.Borders = DevExpress.XtraPrinting.BorderSide.All;
// Create an array of lines and assign it to the rich text.
string[] boxLines = new String[3];
boxLines[0] = "Line 1";
boxLines[1] = "Line 2";
boxLines[2] = "Line 3";
xrRichText1.Lines = boxLines;
// Export its contents to a text file.
xrRichText1.SaveFile("output.txt", XRRichTextStreamType.PlainText);
return xrRichText1;
}