Example E1467
Visible to All Users

Reporting for WinForms - How to Print a Report on a Dot Matrix Printer

This example shows how to print a report on a dot matrix printer. First, the report is exported to CSV format and saved to a temporary file in the current application directory. Then the Process.Start method initiates the printing process. In this example, the verb "Print" is assigned to the ProcessStartInfo.Verb property of the ProcessStartInfo instance passed to the Process.Start method.

Files to Review

Documentation

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

Example Code

Form1.cs(vb)
C#
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Diagnostics; namespace RepPrintOnDotMatrix { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { XtraReport1 report = new XtraReport1(); report.CreateDocument(); printControl1.PrintingSystem = report.PrintingSystem; } private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { printControl1.PrintingSystem.ExportToCsv(Application.StartupPath + "\\temporary.csv", new DevExpress.XtraPrinting.CsvExportOptions(",", Encoding.Default)); ProcessStartInfo startInfo = new ProcessStartInfo(Application.StartupPath + "\\temporary.csv"); startInfo.Verb = "Open"; foreach (var verb in startInfo.Verbs) { if (verb == "Print") startInfo.Verb = "Print"; } Process.Start(startInfo); } } }

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.