按页面将 Crystal Report 拆分为单独的文件

Split Crystal Report Into Separate Files by Page(按页面将 Crystal Report 拆分为单独的文件)
本文介绍了按页面将 Crystal Report 拆分为单独的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将多页水晶报表按页面和名称从它们各自的字段中分解为多个文件.我一直在玩弄 this question 中的代码,但是我遇到了所有类型的 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:
eport 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://social.msdn.microsoft.com/Forums/en-US/f85e167d-edb3-44d0-82fc-2d2b6f92f57b/how-do-i-export-multiple-pdf-files-from-a-single-crystal-report-ie-a-pdf-file-for-each?forum=vscrystalreports

http://scn.sap.com/thread/1132776

这篇关于按页面将 Crystal Report 拆分为单独的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

DispatcherQueue null when trying to update Ui property in ViewModel(尝试更新ViewModel中的Ui属性时DispatcherQueue为空)
Drawing over all windows on multiple monitors(在多个监视器上绘制所有窗口)
Programmatically show the desktop(以编程方式显示桌面)
c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
LINQ many-to-many relationship, how to write a correct WHERE clause?(LINQ多对多关系,如何写一个正确的WHERE子句?)