Page 1 of 1

dc_printfile problem and workaround

Posted: Fri Sep 27, 2013 8:19 am
by BruceN
Due to a significant number of customers having print spooler crashes with dc_printfile, I've had to go to the DCPRINT ON function.

I have my report writing to a text file (report.txt) and then I'm loading that into an array via DELDBE singlefield. and printing the array a line at a time, with an DCPRINT EJECT inserted whenever the line contains '[ Continued ]'.

I'm running into some issues with that method when quotes and commas are in the data. Is there a better way of printing the file?

Perhaps a better way to load the report.txt file into an array than treating it as a single record ascii data file?

thanks,

bruce

Re: dc_printfile problem and workaround

Posted: Fri Sep 27, 2013 10:26 am
by bwolfsohn
Bruce,

Here's another way..

local cText:=memoread('report.txt')
local nLines:=mlcount(alltrim(cText))
FOR i:= 1 TO nLines
if !empty(cLine:=memoline(cText,1024,i))
// print your line here
// or aadd it into an array
endif
NEXT

Re: dc_printfile problem and workaround

Posted: Sun Sep 29, 2013 5:50 am
by BruceN
THANK YOU... that worked perfectly! Although to be honest I expected no less from you wizards :)

I had thought about using memoread, but was unaware off the mlcounrt and memoline functions and couldn't figure out how to break them out.

bruce