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

Skip crystal from exporting column headers in code

40 Views

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.

ex:

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
myReport.Load("c:\test\test1.rpt")

                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
                myReport.Export()

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.