Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print 3 by 4 inch labels? 1

Status
Not open for further replies.

Eviltwin

Programmer
Apr 11, 2001
39
US
Greetings all!
I am trying to print 3 by 4 inch labels on an Okidata ML320 dot matrix printer using Pdox 10. Page setup says that I can create a user defined page size. But the report still will not behave. Any of you know a solution for this?

I have already used the great code supplied by Rick Kelly
on and it solved many of my printer issues but not this one.

Thanks
 
Perrin,
I thank you, my boss thanks you, my co-workers thank you.:) When I get it all complete and working right I will post the code with explanations just in case there is anyone out there that is interested in this topic.

Thanks
Kevin
 
Kevin,

You and your co-workers and boss are very welcome, I enjoy learning by helping others.

I couldn't find the code I mentioned so I wrote something a little different. On this approach I took the string and using breakapart() I created an array containing the words in the string then I put them back together in another array creating elements up to the desired length of the line length, you can change the line length to match your labels. There are many ways you can do this and I'm sure someone out there has a better way but heck this works just fine. The only think I didn't take into account is what happens if a single word is longer than the line length probably would never be a problem but you may want to put in code to handel it. You could also put this code in a procedure to make it more re-usable.

var
arWords array[] string
arLines array[] string
newLine string
x, lineLength number
endvar

lineLength = 60 ; You assign the length of the line here
#Field1.breakapart(arWords) ; break apart the string at spaces
newLine.blank()

for x from 1 to arWords.size()
; if adding to the new line is going to exceed the line length start a new line
if (newLine.size() + arWords[x].size() + 1) > lineLength then
arLines.addlast(newLine)
newLine = arWords[x]
loop
endif
newLine = newLine + " " + arWords[x]
endfor
arLines.addlast(newLine)

for x from 1 to arLines.size()
ts.writeLine(arLines[x])
endFor

Perrin
 
Perrin,
I also enjoy learning by helping others. That's what this whole endeavor is about. I have learned a tremendous amount by creating this application and evolving it into an efficient one. I really enjoy it when the endusers have an app that is easy to understand and reliable. Print issues have been an annoyance to everyone here for a long time. Solving the label issue will make everyone's life a little easier.

So I am going to grab this code and go to work. What I truly enjoy is implementing a function that works--everytime--Call me twisted but it's a rush.
Thanks
Kevin
 
Perrin,
Victory!!Thank you!

For anyone else who might be interested. I will recap and make available the code that allows me to print directly to a dot-matrix printer for the purpose of printing 3 by 4 inch labels. This gets around some print issues in Paradox 10. I am sure there are other solutions but this approach does work.

In my case I needed to do a multi-table query so that the data would be availabe to the textstream in one table. I also wanted the data sorted. In addition I have two 200 character fields that needed to be broken apart and printed on multiple lines. Most importantly the tags need to consistently print the same size. The 200 character fields data varies in length adding another twist. The variable lines printed for those fields needed to be accounted for.
It was also neccesary to format 3 of the number fields so they would print as an integer.

If anyone is interested in the code I would be happy to send it to you. kevin@costumeloft.com

Thanks to everyone who contributes to this forum.
Special thanks to Perrin
Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top