Example E1539
Visible to All Users

Reporting for WinForms - Export a Report to XLSX Format

The code in this repository shows how to export a report to XLSX format.

Files to Review

Documentation

More Examples

Example Code

Form1.cs(vb)
C#
using DevExpress.XtraPrinting; using DevExpress.XtraReports.UI; using System.Windows.Forms; using System; namespace XlsxExportExample { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void simpleButton1_Click(object sender, EventArgs e) { // Create a report. XtraReport report = new XtraReport() { Name = "Report Example", Bands = { new DetailBand() { Controls = { new XRLabel() { Text = "Some content goes here...", } } } } }; // Specify export options. XlsxExportOptions xlsxExportOptions = new XlsxExportOptions() { ExportMode = XlsxExportMode.SingleFile, ShowGridLines = true, FitToPrintedPageHeight = true }; // Specify the path for the exported XLSX file. string xlsxExportFileName = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\Downloads\" + report.Name + ".xlsx"; // Export the report. report.ExportToXlsx(xlsxExportFileName, xlsxExportOptions); System.Diagnostics.Process.Start(xlsxExportFileName); } } }

Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.