Skip to main content

XRRichText.SaveFile(Stream, XRRichTextStreamType) Method

Saves the contents of the XRRichText control to the specified open data stream.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v23.2.dll

NuGet Package: DevExpress.Reporting.Core

Declaration

public void SaveFile(
    Stream data,
    XRRichTextStreamType streamType
)

Parameters

Name Type Description
data Stream

A Stream of data to which the contents of the XRRichText control will be saved.

streamType XRRichTextStreamType

An XRRichTextStreamType enumeration value that identifies the type of stream to save the control’s contents to.

Remarks

Different types of streams can be used to save a control’s contents, which can then save the data to different types of files.

Example

The following code snippet creates the XRRichText object, specifies certain properties, and saves its contents to a file.

using System;
using DevExpress.XtraReports.UI;
// ...

public XRRichText CreateXRRichText(){
    // Create a Rich Text Box control.
    XRRichText xrRichText1 = new XRRichText();

    // Set automatic height calculation,
    // and make the borders visible.
    xrRichText1.CanGrow = true;
    xrRichText1.CanShrink = true;         
    xrRichText1.Borders = DevExpress.XtraPrinting.BorderSide.All;

    // Add lines of text to the document.
    // The XRRichText control converts an array of strings into paragraphs.
    string[] boxLines = new String[3];
    boxLines[0] = "Line 1";
    boxLines[1] = "Line 2";
    boxLines[2] = "Line 3";
    xrRichText1.Lines = boxLines;

    // Export XRRichText contents to Microsoft Office Word OpenXml format (DOCX).
    xrRichText1.SaveFile("output.docx", XRRichTextStreamType.XmlText);

    return xrRichText1;
}
See Also