我如何将.rpt文件转换为csv

时间:2010-06-23 11:34:42

标签: vb.net csv crystal-reports

我继承了一个处理.rpt文件的旧vb6应用程序。我需要将文件中的数据提取为csv格式,以便我可以导入到sql server中。

请帮忙。 感谢

2 个答案:

答案 0 :(得分:1)

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

答案 1 :(得分: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
相关问题