Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Header Repeating exporting to .csv Post Reply Post New Topic
Author Message
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Topic: Header Repeating exporting to .csv
     Posted: 05 Sep 2012 at 4:23am
for some reason my header is repeating for every record all the way down the excel spreadsheet.

here is my code and i checked group settings and such to make sure that it's not set to repeat. any help would be great as i'm new to crystal reports.

WhilePrintingRecords;

Shared StringVar OutputFile;

StringVar Header := "";

Header :=

"LastName, FirstName, Annual Salary, FT/PT, Full/Part%, %Teaching, Ethnicity, Gender, AIMS Stats, NAIS Stas, RPCS Stats, Department, Adv. Degree" +

// Carriage Return / Line Feed
Header := Header + Chr(13) + Chr(10);

// Write line to file
mioMPAYIOAppendToFile (OutputFile, Header);

Header;

the actual header should only be across the top in individual cells and it's not. it's listed in one line and repeated for each employee.

thank you again in advance for any help or advice.
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 05 Sep 2012 at 5:23am
try when recordnumber<>1 then (Outputfile) else

(outputfile, header);
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 05 Sep 2012 at 6:00am
still returning header every other line for a new employee. i left just the header text and took out all code and it still does the same thing. 
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 05 Sep 2012 at 12:14pm
are you exporting data only, xls?
IP IP Logged
comatt1
Senior Member
Senior Member
Avatar

Joined: 19 May 2011
Online Status: Offline
Posts: 337
Quote comatt1 Replybullet Posted: 05 Sep 2012 at 12:16pm
go to export options and open up the options tab, turn off "export page header and page footer"
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 06 Sep 2012 at 4:46am
the report exports to .csv i'm not seeing the turn off "export page header and page footer" option. i do want the header as the top of the spreadsheet then have the data fill in each corresponding cell beneath it. 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 Sep 2012 at 4:26am
Put the header in a Report Header section and the rest of your data in a details section.  Also, you do NOT need to include the carriage return/line feed at the end of the formul - Crystal will automatically handle that in its export.
 
-Dell
IP IP Logged
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Posted: 07 Sep 2012 at 4:39am
that is actually how i have it set up and it is still giving me a header for every employee. 
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 07 Sep 2012 at 4:58am
Are you exporting to "Separated Values (CSV)" or to "Text"?  Which version of Crystal are you using?
 
If it's Separated Values, you should have an option on the final screen prior to export to "Isolate Report/Page Sections".  Turn that on.
 
-Dell
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum