XRRichText.SaveFile(String, XRRichTextStreamType) Method
Saves the contents of the XRRichText control to the specified type of file.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v18.2.dll
Declaration
Parameters
Name | Type | Description |
---|---|---|
path | String | A String containing the name and location of the file to save the control’s contents to. |
streamType | XRRichTextStreamType | An XRRichTextStreamType enumeration value that defines the type of stream to use for saving the XRRichText control’s contents to a file. |
Remarks
Using different types of streams allows a user to save the contents of the XRRichText control into different types of files. If a file pointed to by the path parameter already exists in the specified directory, it will be overwritten without warning.
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;
}