如何使用c#将水晶报告导出到记事本?但是下面的代码是用.pdf导出的 [英] How to export a crystal report to Notepad using c#? But the code below is for exporting in .pdf
本文介绍了如何使用c#将水晶报告导出到记事本?但是下面的代码是用.pdf导出的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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");
}
推荐答案
只需使用intellisense并查看ExportFormatType上有哪些其他可用选项。
参见 http://stackoverflow.com/questions/6320719/how-do-i-export-crystal-report-in-pdf-html-and-doc-formats-using-c -sharp-code-i [ ^ ]用于各种选项。
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.
这篇关于如何使用c#将水晶报告导出到记事本?但是下面的代码是用.pdf导出的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文