cancel
Showing results for 
Search instead for 
Did you mean: 

How to add carriage return to the end of a text file

jsstern
Explorer
0 Kudos

I am working on a payment export file that has to meet strict formatting criteria.  Each line must be 800 characters long and there must be a carriage return at the end.  I set the cpi to the max (72) in order to get all 800 characters to export, but that created blank lines between each row of data.  I used the registry hack suggested by someone on this forum to add the SuppressAllBlankLines and SuppressTrailingNewlines registry keys, which worked great.  However, it also removes the carriage return at the end of the file.

Any suggestions?  Time is of the essence.  Thanks in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

former_member205840
Active Contributor
0 Kudos

Hi Juile,

In crystal using Chr(10) or Chr(13) you can insert a new / carriage return.

the above can be inserted at the end of each line of text.

Thanks,

Sastry

jsstern
Explorer
0 Kudos

I realize that, but the registry setting of Crystal Reports\Export\Text\SuppressAllBlankLines is removing the last carriage return, because it is a blank line.

former_member205840
Active Contributor
0 Kudos

Julie,

Can you try to insert few spaces along with carriage return ..

Something like :

Chr(13)+space(4)

Thanks,

Sastry

jsstern
Explorer
0 Kudos

Hi, Sastry.

I don't think that they will accept a space after the carriage return.  I'm trying Chr(1) to see if it will pass their test.  If not, we may have to do some post processing.

Thanks for your suggestions.

Julie

ido_millet
Active Contributor
0 Kudos

The question is marked as answered, but the text implies it isn't.
If you still need a solution, please indicate so.  There are a couple of alternative approaches...

jsstern
Explorer
0 Kudos

Hi, Ido.

No, I still don't have a solution.  I am working on a postproduction program to open the file and add the carriage return outside of Crystal Reports, but if you know anything that I can do within the .rpt, please let me know.

Thanks.

Julie

ido_millet
Active Contributor
0 Kudos

http://kenhamady.com/bookmarks.html provides a listing of 3rd-party Crystal Reports tools and at least 2 of them can solve this:
a) one of the Crystal Reports Desktop Schedulers allows you to automate exporting to a TEXT file and immediately target the end of the text file for a search & replace operation. The process can also automate emailing or FTP/SFTP operations (sounds like you need to send the resulting file to another company)
- or -
b) several UFLs allow you to use a Crystal Formula to write to a TEXT file (instead of exporting).

jsstern
Explorer
0 Kudos

I will definitely take a look at the 3rd party tools.  For this project, I ended up writing a batch file to append a carriage return to the end of the text file, since I have to copy and rename the file anyway.  Thanks for your help.