Back to Devexpress

XRRichTextStreamType Enum

xtrareports-devexpress-dot-xtrareports-dot-ui-2df1f8b8.md

latest3.4 KB
Original Source

XRRichTextStreamType Enum

Specifies the types of input and output streams used to load and save data in the XRRichText control.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public enum XRRichTextStreamType
vb
Public Enum XRRichTextStreamType

Members

NameDescription
RtfText

A Rich Text Format (RTF) stream.

| | PlainText |

A plain text stream that includes spaces in places of Object Linking and Embedding (OLE) objects.

| | HtmlText |

An HTML stream.

| | XmlText |

A Microsoft Office Word Open XML Format (DOCX) stream.

|

Remarks

Use the members of this enumeration when calling the XRRichText.LoadFile and XRRichText.SaveFile methods of the XRRichText control.

Example

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

csharp
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;
}
vb
Imports System
Imports DevExpress.XtraReports.UI
' ...

Public Function CreateXRRichText() As XRRichText
    ' Create an XRRichText object.
    Dim XrRichText1 As 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.
    Dim BoxLines() As String = New String(2) {}
    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.1SaveFile("output.txt", XRRichTextStreamType.PlainText)

    Return XrRichText1
End Function

See Also

DevExpress.XtraReports.UI Namespace