Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inserting Line Feed at the End
Message
From
07/02/2019 14:32:00
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows XP
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01666039
Message ID:
01666063
Views:
35
>>>>>>At the end of Text Line, in the original one there is LF and in the replaced one there is CRLF. I exactly used what was suggested.
>>>>>>If I copy and Paste from Elsewhere, I get LF at the end, but using the replace command I get CRLF
>>>>>
>>>>>
>>>>>No way. Check attachments.
>>>>
>>>>Sir, Please Check The My original File attached. It can be opened in Notepad. (Not Regular Notepad that comes with windows)
>>>>At Line No 23 the Text is to be replaced. This is not working here.
>>>
>>>What is your FULL code?
>>
>>Here is the code
>>
>>
>>CPSFILEPATH=Alltrim(cFullpath) && Original file will be picked from Here
>>NEWPATH=Alltrim(NEWPATH)  && New rewritten file will be Placed Here
>>
>>Create Cursor BILLCOMPRESS (POS C(254))  && Create Temporary Cursor Billcompress to Check Page Numbers
>>Select BILLCOMPRESS
>>Append From (m.CPSFILEPATH) Sdf && Appends in Standard Data Format
>>*Count Number of Pages in PS File
>>Locate For Alltrim(POS)='%%Page: 1 1'
>>IF Found()
>>Skip
>>IF ALLTRIM(LEFT(POS,9))="<</Duplex"
>>Replace POS With '<</Duplex false/PageSize  [595 842] /Tumble false /ManualFeed false /MediaPosition 0>>  setpagedevice'+ CHR(10)
>>ENDIF
>>ENDIF
>>
>>Set Textmerge On
>>Set Textmerge To (m.NEWPATH) Noshow
>>Scan
>>\\<< TRIM(POS) >>
>>\
>>Endscan
>>Set Textmerge To
>>Set Textmerge Off
>>
>
>
>
>
>Scan
>\\<< TRIM(POS) >>
>\ && THIS line adds CRLF into the file
>Endscan
>
>
>
>
>Try this:
>
>CPSFILEPATH=Alltrim(cFullpath) && Original file will be picked from Here
>NEWPATH=Alltrim(NEWPATH)  && New rewritten file will be Placed Here
>
>Create Cursor BILLCOMPRESS (POS C(254))  && Create Temporary Cursor Billcompress to Check Page Numbers
>Select BILLCOMPRESS
>Append From (m.CPSFILEPATH) Sdf && Appends in Standard Data Format
>*Count Number of Pages in PS File
>Locate For Alltrim(POS)='%%Page: 1 1'
>IF Found()
>   Skip
>   IF ALLTRIM(LEFT(POS,9))="<</Duplex"
>      Replace POS With '<</Duplex false/PageSize  [595 842] /Tumble false /ManualFeed false /MediaPosition 0>>  setpagedevice'
>   ENDIF
>ENDIF
>
>STRTOFILE([], NEWPATH, .f.)
>Scan
>   STRTOFILE(TRIM(POS)+CHR(10), NEWPATH, .t.)
>Endscan
>
>
>
>NOT TESTED


Thanks all of You as told "\" was causing the problem as was inserting Carriage Return after all the lines, though that was not required at a Particular One.
I Changed Code to this and its working correctly now.

Many Thanks to all
Scan 
CPSFILEPATH=Alltrim(Fullpath)
NEWPATH=Alltrim(NEWPATH)
Billcompress=FILETOSTR(m.CPSFILEPATH)
Billcompress=STRTRAN(m.Billcompress,'<</Duplex true /Tumble false /ManualFeed false /MediaPosition 0>>  setpagedevice',;
'<</Duplex false/PageSize  [595 842] /Tumble false /ManualFeed false /MediaPosition 0>>  setpagedevice',1)
STRTOFILE(m.Billcompress,m.NEWPATH,.F.)
Select NEW_BILLS
Wait Window "Inserting["+Alltrim(Str(Recno()))+" of "+Alltrim(Str(m.RECORDSFORSELECTA))+"]" Nowait
ENDSCAN
Harsh
Previous
Reply
Map
View

Click here to load this message in the networking platform