2010-06-23 213 views
0

我继承了处理.rpt文件的旧vb6应用程序。我需要将文件中的数据提取为csv格式,以便我可以导入到sql服务器。如何将.rpt文件转换为csv

请帮忙。 谢谢

+0

提取在.rpt文件的数据?你的意思是保存的数据与报告? – Manjoor 2010-06-23 11:36:18

回答

1

您可以使用Crystal Reports ReportDocument对象动态打开它们,然后调用.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.ExcelRecord,Filename)函数。

VB.NET示例:


Dim Report As New CrystalDecisions.CrystalReports.Engine.ReportDocument 
Report.Load(ReportPathHere) 

' Set Report Parameters; 
Report.SetParameterValue("@PARAM1", Nothing) 

' Generate PDF of report 
Report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.ExcelRecord, FileName & ".xls") 

' Clean up 
Report.Close() 
Report = Nothing 
1

如果这些是Crystal Reports .rpt文件(并且您有兼容版本的Crystal Reports),最简单的方法是在Crystal Reports设计器中打开它们并导出为CSV。