1. Printing In Columns?

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

new topic     » topic index » view message » categorize

2. Re: Printing In Columns?

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

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu