水晶报告导出文件名 [英] crystal report export file name

查看:47
本文介绍了水晶报告导出文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi
我想将水晶报告导出为pdf格式。我想在导出时将报告的名称作为默认文件名。在我的情况下,我使用下面的代码设置报告标题

reportdocument.SummaryInfo.ReportTitle =01-02-2013 to 20-04-2013​​

所以它放了日期范围作为默认文件名,而不是放置实际文件名。

我想保持报告标题显示为报告标题,但同时我想显示报告文件名作为导出时的默认名称。如何解决这个问题,请帮忙?

Hi I want to export a crystal report to pdf format . I want to put the name of the report as default filename while I exporting. In my case I set report title using the code as below
reportdocument.SummaryInfo.ReportTitle = "01-02-2013 to 20-04-2013"
So it put date range as the default filename, instead of putting the actual file name.
I want to keep the report title to show as the report header, but at the same time I want to show the report file name as the default name while exporting. How to solve this, please help?

推荐答案

如果您使用默认对话框进行导出,我认为这是不可能的,



但是,您可以检查Crystal Reports代码隐藏文件中生成的事件,以检查在导出报告时是否触发任何事件。



如果不存在,那么您不必使用默认工具栏按钮进行导出,而是必须创建自己的代码以将其导出为PDF,您可以在导出时指定文件名。



有点像这样。



Dim myRpt作为新的ReportDocument

myRpt.Load(< ; reportfilepath>)

CrystalReportViewer1.ReportSource = myRpt

CrystalReportViewer1.Refresh()

Dim CrExportOptions As ExportOptions

Dim CrDiskFileDestinationOptions As New _

DiskFileDestinationOptions()

Dim CrFormatTypeOptions As New PdfRt fWordFormatOptions()

CrDiskFileDestinationOptions.DiskFileName =< fullpathwithfilename>

CrExportOptions = myRpt.ExportOptions

使用CrExportOptions

.ExportDestinationType = ExportDestinationType.DiskFile

.ExportFormatType = ExportFormatType.PortableDocFormat

.DestinationOptions = CrDiskFileDestinationOptions

.FormatOptions = CrFormatTypeOptions

结束

myRpt.Export()



希望这会有所帮助。
If you are using the default dialog for exporting, i think it will not be possible,

However you can check the events that are generated in the Crystal Reports code behind file to check whether any event is fired at the time of exporting the report.

If this is not there, then instead of using the default toolbar button for export, you have to create your own code for exporting it to PDF, there you can specify the file name while exporting.

Somewhat like this.

Dim myRpt As New ReportDocument
myRpt.Load(<reportfilepath>)
CrystalReportViewer1.ReportSource = myRpt
CrystalReportViewer1.Refresh()
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New _
DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
CrDiskFileDestinationOptions.DiskFileName = <fullpathwithfilename>
CrExportOptions = myRpt.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.PortableDocFormat
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
myRpt.Export()

Hope this helps.


你可以设置您的默认文件名称应为的报告标题..



cr.SummaryInfo.ReportTitle =默认文件名
You may set the Report title which your Default File name should be..

cr.SummaryInfo.ReportTitle = "Default File Name"


这篇关于水晶报告导出文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆