Skip to Content
author's profile photo Former Member
Former Member

Exporting CR2008 rpt to text & Printing the file from C# in Dotmatrix issue

I have a problem printing CrystalReport to DotMatrix printer as It was very slow and printer paining .

After a prolonged serach & article revision , I have installed Vs2008 with Crystal Report 2008 (full).Now , I am able to convert the report to TextFile which is really amazing!!!!. I thougt evey thing is over , However, Still the problem of printing the Report in dotmatrix is very slow.Can you plz tell me what is the exact problem here ...

Note : Once converted the report to text file .. I have to write a separate code to print the TextFile .After imported the crystal report document ,I am calling the Reportdocument.PrinttoPrint ,Printing is started but the report is still the Crystalreport not the exported TEXTFILE.

This is my code : please help me to find the problem ...

txtFilepath = System.Windows.Forms.Application.StartupPath.Replace(@"bin\Release", "") + @"CR_TEXTREPORTS\DayBook.txt";


DiskFileDestinationOptions objDestinationOptions = new DiskFileDestinationOptions();

objDestinationOptions.DiskFileName = txtFilepath;


ExportOptions crExportOptions = new ExportOptions();

//'Set the exporting information

crExportOptions = cryRpt.ExportOptions;

crExportOptions.DestinationOptions = objDestinationOptions;

crExportOptions.ExportDestinationType =ExportDestinationType.DiskFile;

crExportOptions.ExportFormatType =ExportFormatType.Text;

//Export the report


PrintDialog prntDialog = new PrintDialog();


cryRpt.PrintOptions.PrinterName = prntDialog.PrinterSettings.PrinterName;

cryRpt.PrintToPrinter(prntDialog.PrinterSettings.Copies, prntDialog.PrinterSettings.Collate, prntDialog.PrinterSettings.FromPage, prntDialog.PrinterSettings.ToPage);

Please find any problem with the code ..



Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    Posted on Dec 19, 2010 at 06:29 PM

    Hi Martin,

    Since the report works in CR Designer I moved your post to the SDK forum.

    When you use the export option to any destination the PrintToPrinter API does not print the out file. It prints the report as if you were doing it from the viewer.

    What you need to do is not use CR API's and use Windows Printer functions to print the text file from the hard drive.

    I believe a command may work and the old command line command was something like:

    c:\prn c:\mytextfile.txt

    Thank you


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.