![](/img/trans.png)
[英]Export to Excel from Crystal Reports without page headers/footers
[英]Export unformatted Excel data from Crystal Reports
我需要使用Crystal Report導出Excel文件。
有什么方法可以僅導出數據而無需使用代碼進行格式化?
您可以通過不同的方式導出報告中顯示的數據而無需格式化:
1-用ReportExporter控件替換CrystalReportViewer控件。 它將以您選擇的格式導出報告。
2-調用ExportToHttpResponse方法
CrystalReportSource1.ReportDocument.ExportToHttpResponse(ExportFormatType.ExcelRecord, this.Response , false, "report.xls");`
3-調用ExportToDisk方法
reportDocument.ExportToDisk(ExportFormatType.ExcelRecord, "report.xls");
4- 將數據集導出到excel(查看Ahmed答案 )
您可以選擇最適合自己需求的方式,但是必須嘗試使其與在開發或發行服務器中使用的運行時一起使用 。
ExportFormatType.ExcelRecord意味着生成的xls文件無需格式化。 如果設置了ExportFormatType.Excel , 則將標記為“可以增長”的字段與它們下面的空白行合並。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.