How can I align fields in columns using printer.print (DAO) 
Author Message
 How can I align fields in columns using printer.print (DAO)

I'm writing a universal .MDB View/Print app as a learning exercise in my
attempt to move from Foxpro to VB and really can't find a good way to format
fields to maintain column alignment on the printer.  I'm using DAO and tried
both fd.FieldSize and fd.Size in a code line as follows:

Printer.Print fd.Value +space(fd.fieldsize - len(fd.value))

Sometimes fieldsize reverts to 0 in spite of the fact that the field has
data and I get a negative argument to SPACE().  I get type mismatches if the
field is not a string type.  I could hardcode the output and tailor the code
to a specific database, but that's not efficient.  The MDB has 74 tables
(corporate office created it).  My app lists the tables in a picklist and
displays the data in a DBGrid.  File\Print sends it to the printer and my
only show stopper at this point is the problem of formatting.

Any ideas??

Dave



Wed, 19 Dec 2001 03:00:00 GMT
 How can I align fields in columns using printer.print (DAO)

Try to use a non proportional font, i think it will solve your problems.
L.P.P.


Quote:
> I'm writing a universal .MDB View/Print app as a learning exercise in my
> attempt to move from Foxpro to VB and really can't find a good way to
format
> fields to maintain column alignment on the printer.  I'm using DAO and
tried
> both fd.FieldSize and fd.Size in a code line as follows:

> Printer.Print fd.Value +space(fd.fieldsize - len(fd.value))

> Sometimes fieldsize reverts to 0 in spite of the fact that the field has
> data and I get a negative argument to SPACE().  I get type mismatches if
the
> field is not a string type.  I could hardcode the output and tailor the
code
> to a specific database, but that's not efficient.  The MDB has 74 tables
> (corporate office created it).  My app lists the tables in a picklist and
> displays the data in a DBGrid.  File\Print sends it to the printer and my
> only show stopper at this point is the problem of formatting.

> Any ideas??

> Dave



Fri, 21 Dec 2001 03:00:00 GMT
 How can I align fields in columns using printer.print (DAO)
Thanks.  That works, and it will get me by in most cases, but the printer
object seems to be using tab delimited output.  If you have a short field
value string in a column and longer ones in others, VB tabs but doesn't get
you past the end of the current field/column.  The result is random columns
that have their data one tab to the left (intruding into the previous
column).

There must be a reliable way to extract field size reliably.  The grid
controls do a good job, so the info must be there.  As I said in my original
post, field.fieldsize and field.size return unreliable data depending upon
the type of field in the table.  As I understand the help files, MEMO fields
and variable type fields don't always return what you expected.

Any ideas or is someone willing to run through the ins and outs of table
printing in columns for a VB convert?

Quote:

>Try to use a non proportional font, i think it will solve your problems.
>L.P.P.



>> I'm writing a universal .MDB View/Print app as a learning exercise in my
>> attempt to move from Foxpro to VB and really can't find a good way to
>format
>> fields to maintain column alignment on the printer.  I'm using DAO and
>tried
>> both fd.FieldSize and fd.Size in a code line as follows:

>> Printer.Print fd.Value +space(fd.fieldsize - len(fd.value))

>> Sometimes fieldsize reverts to 0 in spite of the fact that the field has
>> data and I get a negative argument to SPACE().  I get type mismatches if
>the
>> field is not a string type.  I could hardcode the output and tailor the
>code
>> to a specific database, but that's not efficient.  The MDB has 74 tables
>> (corporate office created it).  My app lists the tables in a picklist and
>> displays the data in a DBGrid.  File\Print sends it to the printer and my
>> only show stopper at this point is the problem of formatting.

>> Any ideas??

>> Dave



Sat, 22 Dec 2001 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. align summary fields under table columns?

2. Using the Print Screen Key to print to printer or to file

3. need to align a single text field with a repeating Number field

4. Printing/not printing text using calculated fields with Paradox 4.0

5. printing different sets of fields from one form to diferent printers

6. Controlling Dot-matrix printer using print method

7. Progress Printing to TTY printer vs System Printer

8. printing problems using different printers

9. FPW2.6 printing to network printer w/SET DEVICE TO PRINTER

10. Pdx 7 - Printing to a text file using the Generic Printer driver


 
Powered by phpBB® Forum Software