cancel
Showing results for 
Search instead for 
Did you mean: 

Skip crystal from exporting column headers in code

former_member1012208
Participant
0 Kudos
71

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.

Accepted Solutions (1)

Accepted Solutions (1)

Adam_Stone
Active Contributor
0 Kudos

You are currently explicitly telling it to export the headers with these two lines


CrFormatTypeOptions.ReportSectionsOption = CsvExportSectionsOption.Export
CrFormatTypeOptions.GroupSectionsOption = CsvExportSectionsOption.Export

Change the value to CsvExportSectionsOption.DoNotExport

former_member1012208
Participant
0 Kudos

That works. Thanks a lot. Now I have a different problem. In the dtail section of my report, I am showing only certain records based on a condition. When I export the report in designer, everything works well, but the export result from the code inserts some blank lines because of the condition. Is there away to eliminate this/?

Answers (1)

Answers (1)

former_member1012208
Participant
0 Kudos

-