我想在Crystal Report中從ASP.Net製作報告。我想,當用戶點擊打印時,它應該只顯示保存,打開,另存爲的瀏覽器對話框,並且應該保存PDF,或者應該出現Crystal Report打印預覽,我不想先在Viewer中顯示報告,然後點擊按鈕獲得打印或PDF,我只需要點擊asp按鈕,我有所有的參數的想法,並知道如何做出報告,我的問題是隻是不顯示查看器,並從一個窗體的ASP按鈕報告的PDF或打印預覽對話框打印。我已經使用.Net for Crystal Report的Export方法,但它不起作用。Crystal Report直接另存爲PDF,而不是查看
6
A
回答
2
這裏是解決方案,您正在尋找:
http://www.c-sharpcorner.com/UploadFile/mahesh/ExportCRtoPDF10062006161918PM/ExportCRtoPDF.aspx
下面是從網站報價:
以下步驟將引導你達到相同的:
將水晶報表(.cr)文件添加到您的ASP.NET應用程序。 在頁面級別添加報表實例。
昏暗報告作爲MyReport =新MyReport
填充報告上Page_Init數據
昏暗DS作爲數據集=的GetData()
report.SetDataSource(DS)
出口報告
report.ExportToHttpResponse(ExportFormatType.PortableDocFormat,響應,假,「ExportedReport」)
如果你想爲其他格式格式的報表,只需改變ExportFormatType枚舉值>你想要的格式。
如果您希望下載報告,則只需將第4步中的> ExportToHttpResponse方法的第三個參數更改爲True。
4
您可以通過使用水晶報表和一段代碼生成一個PDF ....
第一:生成一個水晶報表按您的要求。
二:使用下面的代碼來生成PDF:
廣場下面的名字空間的代碼頁
Imports CrystalDecisions.CrystalReports.Engine Imports CrystalDecisions.Shared
變量聲明頂部
Dim CrReport As New CrystalReport1() // Report Name Dim CrExportOptions As ExportOptions Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions() Dim CrFormatTypeOptions as New PdfRtfWordFormatOptions()
設置目標路徑和文件名
CrDiskFileDestinationOptions.DiskFileName = "c:\RichText.pdf"
指定頁面範圍(可選)
crFormatTypeOptions.FirstPageNumber = 1 // Start Page in the Report crFormatTypeOptions.LastPageNumber = 3 // End Page in the Report crFormatTypeOptions.UsePageRange = True
設置導出選項
CrExportOptions = crReport.ExportOptions With CrExportOptions // Set the destination to a disk file .ExportDestinationType = ExportDestinationType.DiskFile // Set the format to PDF .ExportFormatType = ExportFormatType.PortableDocFormat // Set the destination options to DiskFileDestinationOptions object .DestinationOptions = CrDiskFileDestinationOptions .FormatOptions = crFormatTypeOptions End With
陷阱出口出現的任何錯誤
Try // Export the report CrReport.Export() Catch err As Exception MessageBox.Show(err.ToString()) End Try
多數民衆贊成它....現在你已經準備好創建報告的PDF。
相關問題
- 1. 如何使Crystal Report直接打印到打印機而不導出爲PDF?
- 2. Crystal Report查看頁碼
- 3. Report Writer另存爲Crystal Reports rpt文件
- 4. Crystal Report查看數據庫查詢
- 5. 要查看在Crystal Report中生成的PDF
- 6. 將Crystal Report導出爲PDF凍結 - Vb.Net2003
- 7. Crystal Report ASP.NET查看器和IE 10
- 8. 如何查看沒有CrystalReportViewer的Crystal Report?
- 9. 在Crystal Report中查看存儲在SQL Server中的圖像
- 10. crystal report&sub report
- 11. 如何直接打印報表,而不在Crystal Reports去查看器
- 12. 是否需要安裝Crystal Report Viewer才能查看報告?
- 13. Crystal Report - Report Header Section
- 14. Crystal report打印按鈕打開pdf頁
- 15. Crystal Report Viewer不接受登錄信息
- 16. 如何直接下載birt報告而不是在查看器中查看?
- 17. ErrorController處理錯誤,而不是直接查看
- 18. Crystal Report控件中的垂直對齊
- 19. CRYSTAL REPORT什麼是x:= x;?
- 20. Crystal Report將不會出現在Crystal ReportViewer
- 21. ASP.NET 3.5 - 在PDF查看器中直接從流中打開PDF
- 22. Crystal Report Formula missing
- 23. Crystal Report Printing Stop
- 24. Crystal Report grow horziontal
- 25. Crystal Report - )缺失
- 26. Crystal Report with VB6
- 27. Crystal Report Licensing
- 28. Incrementing Array Crystal Report
- 29. ASP.NET和Crystal Report
- 30. Crystal Report和ODP.Net