Click here to Skip to main content
15,667,847 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
private void frmRptInvoice_Load(object sender, EventArgs e)
        {

            ReportDocument cryRpt = new ReportDocument();
            TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();
            TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();
            ConnectionInfo crConnectionInfo = new ConnectionInfo();
            Tables CrTables;
            cryRpt.Load("C:/Users/Gilbert/Desktop/OKSOFT/softNew/bill2.rpt");
             //C:\Users\Gilbert\Desktop\softNew\softNew\rptAllBills.rpt
            crConnectionInfo.ServerName = "GILBERT-PC";
            crConnectionInfo.DatabaseName = "dbAutorec";
            crConnectionInfo.UserID = "sa";
            crConnectionInfo.Password = "newgt";

            CrTables = cryRpt.Database.Tables;
            foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)
            {
                crtableLogoninfo = CrTable.LogOnInfo;
                crtableLogoninfo.ConnectionInfo = crConnectionInfo;
                CrTable.ApplyLogOnInfo(crtableLogoninfo);
            }

            crystalReportViewer1.ReportSource = cryRpt;
            crystalReportViewer1.Refresh();

            cryRpt.ExportToDisk(ExportFormatType.PortableDocFormat, "catalogueReport.pdf");
            //Preview the generated PDF
            System.Diagnostics.Process.Start(Application.StartupPath + "\\catalogueReport.pdf");
        }
Posted
Comments
ZurdoDev 6-Oct-14 10:41am    
What exactly is your question?
Gilbertinino 6-Oct-14 10:45am    
I need to export my report to Notepad, I mean exporting a crystal report to Notepad instead of PDF.

1 solution

Just use intellisense and see what other options are available on ExportFormatType.

See http://stackoverflow.com/questions/6320719/how-do-i-export-crystal-report-in-pdf-html-and-doc-formats-using-c-sharp-code-i[^] for various options.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900