1. Printing In Columns?
- Posted by Tony Steward <tony at locksdownunder.com> Jan 02, 2002
- 407 views
Hi All, I want to print data in columns using a proportional font as I think this looks much better. To do this I would need to 1st specify the font and size, then determine the length of a line on the printer then divide this by the number of columns and also a gutter measurement and then trim the data to fit in the column. Finally working out where to print the 2nd or 3rd column etc. Can anyone help with this? I know it would be easier with non-proportional font but as always I want my cake and to eat it too. Any Ideas? Thanks Tony Steward
2. Re: Printing In Columns?
- Posted by Irv Mullins <irvm at ellijay.com> Jan 03, 2002
- 386 views
On Thursday 03 January 2002 12:10 am, you wrote: > > Hi All, > I want to print data in columns using a proportional font as I think > this looks much better. To do this I would need to 1st specify the font > and size, then determine the length of a line on the printer then divide > this by the number of columns and also a gutter measurement and then > trim the data to fit in the column. Finally working out where to print > the 2nd or 3rd column etc. > > Can anyone help with this? I know it would be easier with > non-proportional font but as always I want my cake and to eat it too. > > Any Ideas? > You can expand the printPage() function in my printer.e file (posted to RDS a few days ago) to do what you want, with one caveat: you will never get columns of numbers to look right if they are printed in a proportional font. Other than that, just change the 0 in the line below to whatever x location you want to begin printing the line. setPenPos(Printer, 0, posY) -- locate to beginning of next line wPuts(Printer,doc[1]) -- print the first line doc = doc[2..length(doc)] -- remove the printed line posY += fontY -- add the font height to the current position I might modify the routine to expect a sequence of strings: {"Tony Steward","Programmer","tony at locksdownunder.com"} rather than a single string, and set up an array of "tab stops" to hold the origin of each column. As an alternative, I might just append a tab character, and parse the line based on that character: "Tony Steward/tProgrammer/ttony at locksdownunder.com" Whenever I hit a '/t', I'd change the 0 to whatever the next tab stop was set for. strtok.e would be useful here. If you want to get really fancy, you could pass both X and Y coordinates, and stick text anywhere on the page you want - in any font style. If you get to this point, you're doing page layouts, not reports, so the printer.e file wouldn't be much use. Regards, Irv