[英]Asp.net crystal report (dynamic change)
hi all ! 大家好 ! I am developing one asp.net application and the requirement is as below.
我正在开发一个asp.net应用程序,要求如下。 user can view multiple reports(i have used crystal reports).
用户可以查看多个报告(我已经使用过水晶报告)。 Each report has edit report button.when the user click on edit button,then report will be open in excel sheet on different webpage.then user make suitable changes like sorting etc and save this report and take an updated print.
每个报告都有编辑报告按钮。当用户单击编辑按钮时,报告将在不同网页上的excel工作表中打开。然后用户进行适当的更改(如排序等)并保存该报告并进行更新打印。
CristalReportsViewer
in the page, one for each report you want to show CristalReportsViewer
,每个要显示的报告一个 CristalReportsSource
in the page, one for each report you want to show CristalReportsSource
,每个要显示的报告一个 CristalReportsSource
to a CristalReportsViewer
CristalReportsSource
链接到CristalReportsViewer
CristalReportsSource
the relative source myreport.rpt
CristalReportsSource
设置相对源myreport.rpt
put many buttons that export the reports, using this sample code 使用此示例代码,放置了许多用于导出报告的按钮
protected void btnExport_Click(object sender, EventArgs e) { // Stop buffering the response Response.Buffer = false; // Clear the response content and headers Response.ClearContent(); Response.ClearHeaders(); ExportFormatType format = ExportFormatType.Excel; try { reportDocument.ExportToHttpResponse(format, Response, true, "report.xls"); } catch (System.Threading.ThreadAbortException) { //happens; no matter } catch (Exception ex) { Response.Write(ex.StackTrace); } }
You can show a single report, and allow users choosing the desired report unsing a dropdown with this sample code 您可以显示一个报告,并允许用户在不使用此示例代码的下拉菜单中选择所需的报告
reportDocument = new ReportDocument();
string reportName = "myreport.rpt";
reportDocument.Load(Server.MapPath(string.Format("~/{0}/{1}", "MyReportsFolder", reportName)));
CrystalReportViewer1.ReportSource = reportDocument;
reportDocument.ReadRecords();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.