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.
- 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);
}
(you will be redirected to DevExpress.com to submit your response)