on 2012 Aug 10 7:39 PM
I am using the following code to export a report into csv. But this code only works well, if I don't have field headers defined.
If my report has header info in the report header, when exporting, Crystal inserts the header information at the begining of each record.
I only need it once atr the top of the report, not at the start of each record.
Does anyone know how to get it exported only once at the start of the report?
Dim myReport As New ReportDocument
myReport.Load(ReportNameAndPath)
Dim CrExportOptions As ExportOptions
Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
Dim CrFormatTypeOptions As New CharacterSeparatedValuesFormatOptions ' ExcelFormatOptions
CrFormatTypeOptions.SeparatorText = ""
CrFormatTypeOptions.Delimiter = ""
CrFormatTypeOptions.ExportMode = CsvExportMode.Standard
CrFormatTypeOptions.ReportSectionsOption = CsvExportSectionsOption.Export
CrFormatTypeOptions.GroupSectionsOption = CsvExportSectionsOption.Export
CrDiskFileDestinationOptions.DiskFileName = tmpExcelFile
CrExportOptions = myReport.ExportOptions
With CrExportOptions
.ExportDestinationType = ExportDestinationType.DiskFile
.ExportFormatType = ExportFormatType.CharacterSeparatedValues
.DestinationOptions = CrDiskFileDestinationOptions
.FormatOptions = CrFormatTypeOptions
End With
myReport.Export()
I am using VS2010 and Crystal reports 2008
VS 2010 and Crystal 2008 runtime is not supported platform, should work but no fixes available. Try Cr for Vs 2010.
What happens when you export from the Designer?
Try the latest Service Packs for CR 2008 to see if that helps, if not then try CR for Vs 2010 SP 4.
Don
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Don,
What are these 2 variables being set to?
CrFormatTypeOptions.ReportSectionsOption = CsvExportSectionsOption.Export
CrFormatTypeOptions.GroupSectionsOption = CsvExportSectionsOption.Export
Do you have a sample report with saved data I can test with?
Go into the Advanced Editor and rename the report to *.txt, then you can attach it to the post. must be less than 1 meg. And rename and attach what the output from the designer looks like.
Don
User | Count |
---|---|
69 | |
11 | |
10 | |
10 | |
9 | |
7 | |
7 | |
7 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.