Back to Devexpress

Export to Text

xtrareports-2577-feature-guide-to-devexpress-reports-store-and-distribute-reports-export-reports-export-to-text.md

latest3.8 KB
Original Source

Export to Text

  • Feb 18, 2026
  • 6 minutes to read

This document describes how to export a report document to text format.

You can export a report from the Report Designer’s Preview and the Document Viewer on all supported platforms (WinForms, WPF, ASP.NET Web Forms, ASP.NET MVC, and ASP.NET Core). To do this, expand the Export Document drop-down list and select Text File. Specify export options in the invoked dialog, and click OK.

To export a report document to text format in code, use one of the following approaches:

  • Export a Report

  • Export a Document

  • Export a Control

The report is exported into one file that contains one page (the Single File mode). The report’s page headers, footers, top and bottom margins appear only once, at the beginning and end of the resulting page.

Use the TextExportOptions.TextExportMode property to specify how to export text data from controls:

  • Set this property to Text to export data fields as strings. The formatting is embedded in these strings.
  • Set this property to Value to export data field values.

To ensure that report controls are exported correctly, they should not intersect. Otherwise, the file layout can be corrupted.

Overlapped controls are highlighted in reports. Users can move the mouse pointer over these controls to see what needs to be fixed.

Use a report’s HasExportWarningControls collection to check if there are controls that have export warnings.
Disable a report’s DesignerOptions.ShowExportWarnings property to remove highlights on overlapped controls.

You cannot export reports merged page by page in the Single File export mode. As a workaround:

  • Use subreports to merge multiple reports into a single document.
  • Export all reports to separate files and join these files in a single file.

When you export to text, the XRControl class’s GetTextView protected method is invoked. This method is overridden in report controls and returns a 2-dimensional array of strings used for the text representation of a control. For instance, the XRLabel is represented as a string, the XRRichText as a 1-dimensional array of strings, the XRTable as a 2-dimensional array of strings, and the XRPictureBox cannot be represented as a string.

If a report uses a CachedReportSource, changes made in Preview are not included in the exported file.