Crystal reports 如何在本地系统中将Crystal报表导出为PDF?
我需要以Crystal reports 如何在本地系统中将Crystal报表导出为PDF?,crystal-reports,export-to-pdf,Crystal Reports,Export To Pdf,我需要以PDF格式将crystal报告导出到本地系统 我使用了ExporttoDesk,但它保存在服务器中。我需要让用户可以使用它 可能吗 我使用了ExporttoStream。但它对我也不起作用 请告诉我实现这一目标的方法 谢谢, Rakesh.点击按钮试试这个 try { ExportOptions CrExportOptions ; DiskFileDestinationOptions CrDiskFileDestinatio
PDF
格式将crystal报告导出到本地系统
我使用了ExporttoDesk
,但它保存在服务器中。我需要让用户可以使用它
可能吗
我使用了ExporttoStream
。但它对我也不起作用
请告诉我实现这一目标的方法
谢谢,
Rakesh.点击按钮试试这个
try
{
ExportOptions CrExportOptions ;
DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();
CrDiskFileDestinationOptions.DiskFileName = "c:\\csharp.net-informations.pdf";
CrExportOptions = cryRpt.ExportOptions;
{
CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
CrExportOptions.FormatOptions = CrFormatTypeOptions;
}
cryRpt.Export();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
读一下它的解释吧,现在回答这个问题已经太迟了,但对像我这样的人来说可能有用
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument pdfReport = new ReportDocument();
pdfReport.Load(Server.MapPath("ExportToPdf.rpt"));
pdfReport.SetDatabaseLogon("amitjain","password", @"AMITJAIN\SQL", "Northwind");
CrystalReportViewer1.ReportSource = pdfReport;
}
protected void btnExport_Click(object sender, EventArgs e)
{
ReportDocument pdfReport = new ReportDocument();
pdfReport.Load(Server.MapPath("ExportToPdf.rpt"));
pdfReport.SetDatabaseLogon("user", "password", @"AMITJAIN\SQL", "Northwind");
Response.Buffer = false;
Response.ClearContent();
Response.ClearHeaders();
pdfReport.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, true, "Employees");
Response.End();
}
测试和工作。当我们有参数时,如何进行测试?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Dim Report As ReportDocument = New ReportDocument()
Report.Load(Server.MapPath("~/CrystalReport.rpt"))
Report.SetDatabaseLogon("sa", "######", "IT250WS", "demo")
CrystalReportViewer1.ReportSource = Report
End Sub
Protected Sub btnPDF_Click(ByVal sender As Object, ByVal e As EventArgs)
Dim Report As ReportDocument = New ReportDocument()
Report.Load(Server.MapPath("~/CrystalReport.rpt"))
Report.SetParameterValue("@EmpId", 1)
Report.SetDatabaseLogon("sa", "######", "IT250WS", "demo")
Response.Buffer = False
Response.ClearContent()
Response.ClearHeaders()
Report.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "File_Name")
Response.[End]()
End Sub
您好…这是一个web应用程序,我已经实现了您的代码,但它没有下载任何文件a。欢迎使用解决方案,但请确保您的答案在没有它的情况下是有用的:在链接周围添加上下文,以便您的其他用户能够了解它是什么以及它为什么存在,然后引用你链接到的页面最相关的部分,以防目标页面不可用。已经有一个答案说明你提供了什么。没有理由重复这个答案。@hongsy在这里我是说,他问的问题中有参数,没有参数。我希望你能理解和支持我。