将Crystal报表按页面拆分为单独的文件 [英] Split Crystal Report Into Separate Files by Page
问题描述
我正在尝试将多页Crystal报表按页面和名称(根据其各自的字段)分成多个文件。我一直在愚弄这个问题中的代码,但是我遇到了所有类型的SAP错误的。有没有一种简单的方法可以像这样迭代:
I'm trying to break a multi page crystal report into multiple files by page and name according from their respective fields. I've been fooling around with the code from this question however I run into all type of SAP error's. Is there not a simple way to iterate say like:
foreach(var page in CrystalReport)
{
report.ExportTiDisk(ExportFormatType.WordForWindows, page.[NameField]);
}
最糟糕的情况是我可以使用Word API来做到这一点,但是另一种蠕虫可以我宁愿不开放。
Worst case I could do this with the Word API but that another can of worms I'd rather not open.
谢谢您
推荐答案
亲爱的,请检查代码。
为什么需要导出多个文件,这很糟糕,因为假设您的报告包含300页的结果,那么您认为可以将300个文件出口和客户检查每个&每个文件。再想一想。
Why you need to export in multiple files, it is bad as suppose you have a report with 300 pages result, then are you think to make 300 files to export and customer to check each & every files. Think again.
这仍然是解决方案,请参考下面的VB.Net代码导出到单独的pdf文件。
Still here is solution, Please refer to the following VB.Net code for exporting to seperate pdf files.
Dim rdoc As New ReportDocument
'------------------------------------
'Add your code to set rdoc object
'--------------------------------------
Dim exportOpts As ExportOptions = New ExportOptions()
Dim pdfRtfWordOpts As PdfRtfWordFormatOptions = ExportOptions.CreatePdfRtfWordFormatOptions()
Dim destinationOpts As DiskFileDestinationOptions = ExportOptions.CreateDiskFileDestinationOptions()
For li_count As Integer = 1 To pagecount
pdfRtfWordOpts.FirstPageNumber = li_count
pdfRtfWordOpts.LastPageNumber = li_count
pdfRtfWordOpts.UsePageRange = True
exportOpts.ExportFormatOptions = pdfRtfWordOpts
exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat
destinationOpts.DiskFileName = "D:\report File" & li_count & ".pdf"
exportOpts.ExportDestinationOptions = destinationOpts
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
rdoc.Export(exportOpts)
Next
引用链接导出为多个文件
您尚未编写CR版本,因此也请参考此链接,其中说在cr-2008中无法导出多个文件。
You have not written your CR-version, So please refer to this link also which says, not able to export in multiple files in cr-2008.
http://scn.sap.com/thread/1132776
这篇关于将Crystal报表按页面拆分为单独的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!