Skip to Content
Oct 27, 2010 at 07:03 PM

ExportOptions for CSV Format Not Being Set



Using CR2008 with VS 2008. I'm exporting a report to CSV and it looks like the CharacterSeparatedValuesFormatOptions are not being set, even though they are being passed and I see them set in the Object Viewer when I step through the program.

It's not overly complicated, the other options are being passed just lovely. I need to set the CsvExportMode as Standard so the column titles are the first row and not beside them.

I had Process Explorer check to make sure the proper version of the Engine and export drivers were loaded. The exporting works without errors, the correct data is there and saved to the proper folder and filename.

Please help, it's the first day of sun and I really don't want to stay in the office to play with this much longer.

Dim crExportOptions As New ExportOptions
                Dim CSVFormatOptions As New CharacterSeparatedValuesFormatOptions
                Dim crDestinationOptions As New DiskFileDestinationOptions

                crDestinationOptions.DiskFileName = My.Computer.FileSystem.SpecialDirectories.Desktop & "\CBV_SIF_" & Request.QueryString("campaign") & ".csv"

                crExportOptions.ExportDestinationType = ExportDestinationType.DiskFile
                crExportOptions.ExportDestinationOptions = crDestinationOptions
                crExportOptions.ExportFormatType = ExportFormatType.CharacterSeparatedValues

                CSVFormatOptions.ExportMode = CsvExportMode.Standard
                CSVFormatOptions.ReportSectionsOption = CsvExportSectionsOption.Export
                CSVFormatOptions.ReportSectionsOption = CsvExportSectionsOption.ExportIsolated
                CSVFormatOptions.GroupSectionsOption = CsvExportSectionsOption.Export
                CSVFormatOptions.GroupSectionsOption = CsvExportSectionsOption.ExportIsolated

                crExportOptions.ExportFormatOptions = CSVFormatOptions