Skip to content

DevExpress-Examples/reporting-winforms-print-report-in-dot-matrix-printer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

To print a DevExpress report on a dot matrix printer, use the following workaround:

  • Export the report to text format (CSV or TXT).
  • Send the resulting file to the printer.

Implementation Details

  • Export the report to CSV and save it to a temporary file (temporary.csv, in this example).
  • Create a ProcessStartInfo object and assign “Print" to the Verb property (if this verb is listed among supported options).
  • Call the Process.Start method and pass the customized ProcessStartInfo object as the parameter.
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);
}

Files to Review

Documentation

Does this example address your development requirements/objectives?

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

About

This example prints a report on a dot matrix printer.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 3

  •  
  •  
  •