susan matson
susan matson

Reputation: 41

CSV export repeats headers with each field value

I know this is going to be a really simple answer... when I export my header comes out on each export line preceding the fields that are being exported. I want the header line to export in csv in the 1st line, with the record lines underneath.

Upvotes: 3

Views: 13579

Answers (3)

Sini
Sini

Reputation: 21

You can display the crystal reports as CSV files in the same way as they appear in reports by doing the below thing. This will export into pdf excel or word in exactly same way you want to display

string contentType = "";
        ExportOptions options = new ExportOptions();
        switch (formatType.ToLower())
        {
            case "pdf":
            default:
                options.ExportFormatType = ExportFormatType.PortableDocFormat;
                contentType = "application/pdf";
                break;
            case "excel":
                options.ExportFormatType = ExportFormatType.Excel;
                contentType = "application/vnd.ms-excel";
                break;
            case "csv":
                contentType = "application/csv";

                options.ExportFormatType = ExportFormatType.CharacterSeparatedValues;
                //CharacterSeparatedValuesFormatOptions v= ExportOptions.CreateCharacterSeparatedValuesFormatOptions();
                //v.SeparatorText

                options.ExportFormatOptions = new CharacterSeparatedValuesFormatOptions()
                {
                    ExportMode = CsvExportMode.Standard,
                    GroupSectionsOption= CsvExportSectionsOption.ExportIsolated,
                ReportSectionsOption = CsvExportSectionsOption.ExportIsolated
                };
                break;
        }

Upvotes: 2

paulmelnikow
paulmelnikow

Reputation: 17218

This discussion suggests a couple options:

  1. Export to Excel first, then save as CSV
  2. Modify some registry keys

http://sagecity.na.sage.com/support_communities/sage100_erp/f/97/p/38336/125272

Upvotes: 0

Chords
Chords

Reputation: 6858

When you select CSV as your export option it'll open a new dialog box. In it, note the Report and Page Sections section. Leave it set to Export but be sure to check Isolate Report/Page sections. It'll then work how you'd expect.

Upvotes: 11

Related Questions