Skip to Content
Jan 05, 2012 at 04:48 PM

Skip crystal from exporting column headers in code


I have written a crystal report that I have included some groupings, but kept them as surpressed (no drill down). When I export this report from Crystal designer, everything work fine, but when I use the following code to export it, for each line Crystal exports the column headers and then the data.


If I have the following coltents in Table 1

id empid name

111 a1 aaa

222 b2 bbb

333 c3 ccc

I have grouped my report on id and kept it surpresed. I use the following code to export the report

Dim myReport As New ReportDocument

                Dim CrExportOptions As ExportOptions
                Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
                Dim CrFormatTypeOptions As New CharacterSeparatedValuesFormatOptions 
                CrFormatTypeOptions.SeparatorText = ""
                CrFormatTypeOptions.Delimiter = ""
                CrFormatTypeOptions.ExportMode = CsvExportMode.Standard
                CrFormatTypeOptions.ReportSectionsOption = CsvExportSectionsOption.Export
                CrFormatTypeOptions.GroupSectionsOption = CsvExportSectionsOption.Export
                CrDiskFileDestinationOptions.DiskFileName = tmpfile
                CrExportOptions = myReport.ExportOptions
                With CrExportOptions
                    .ExportDestinationType = ExportDestinationType.DiskFile
                    '.ExportFormatType = ExportFormatType.Excel
                    '.ExportFormatType = ExportFormatType.CharacterSeparatedValues
                    .ExportFormatType = ExportFormatType.CharacterSeparatedValues
                    .DestinationOptions = CrDiskFileDestinationOptions
                    .FormatOptions = CrFormatTypeOptions
                End With

With this code I get hte following file

id empid name 111 a1 aaa

id empid name 222 b2 bbb

id empid name 333 c3 ccc

How do I skip the column headers? Any help is greatly appreciated.