Align printed text output 
Author Message
 Align printed text output

Use the TAB function instead of inserting spaces.  This is much more
effective and more reliable.

ie.  Printer.Print "NAME"; Tab(20); LOGINS; Tab(40); _
        TOTAL LOGIN TIME; Tab(75); AVG LENGTH; Tab(85)

Once that is done, if you want to align what is to go under "TOTAL LOGIN
TIME", just type:

        Printer.Print Tab(40); TotalLoginTime

Later,
Jody



Sun, 09 Jan 2000 03:00:00 GMT
 Align printed text output

I am using VB4 Professional Edition, When I print the data I need I am
unable to get the text to align properly.

Here is the code I'm using

Private Sub cmdPReport_Click()
Dim db As Database, rs As Recordset
Dim beginpage, endpage, numbcopy, ic
Dim printhead As String
printhead =  _
"NAME          LOGINS     TOTAL LOGIN TIME          AVG LENGTH    "
Set db = DBEngine.Workspaces(0).OpenDatabase("C:\project\billing.mdb")
Set rs = db.OpenRecordset(datData1.RecordSource, dbOpenSnapshot)
rs.MoveFirst
If datData1.RecordSource = "SELECT * From User order by [NAME2] asc" _
Then
      CommonDialog1.CancelError = True
      CommonDialog1.ShowPrinter
      beginpage = CommonDialog1.FromPage
      endpage = CommonDialog1.ToPage
      numbcopy = CommonDialog1.Copies
      For ic = 0 To numcopy
      Printer.Print printhead
        While Not rs.EOF
           Printer.Print rs!NAME2 &  rs!LOGINS & rs!TOTAL_LOGIN_TIME _

              & rs!AVG_LENGTH
           rs.MoveNext
       Wend
    Printer.EndDoc
       Next
    Exit Sub
ElseIf datData1.RecordSource = "select * from Modem" Then
....
....
....

End Sub

I have tried putting spaces in between the feilds I am loading in the
'Printer.Print' line, but the text will not align properly.

Here is a sample:

NAME          LOGINS     TOTAL LOGIN TIME          AVG LENGTH    
acampton          3       6 Hours 11 Min          2 Hours 3.666667Min.
bcoffey          30       13 Hours 19 Min       0 Hours 0.6333333 Min.
bduncan          2       0 Hours 46 Min               0 Hours 23 Min.
bnewman          7       1 Hours 1 Min          0 Hours 0.1428571 Min.
bpatton          16       2 Hours 6 Min            0 Hours 0.375 Min.
bsharp          30       30 Hours 44 Min         1 Hours 1.466667 Min.
bwilkin          10       3 Hours 58 Min              0 Hours 5.8 Min.

Crystal reports is not an option in this application.  Does anybody
have any suggestions as to how I can get this text to align like
this(or close to it):

NAME         LOGINS   TOTAL LOGIN TIME   AVG LENGTH    
acampton    3              6 Hours 11 Min            2 Hours 3.67 Min.
bcoffey        30           13 Hours 19 Min           0 Hours 0.6 Min.
bduncan      2             0 Hours 46 Min             0 Hours 23 Min.
bnewman     7            1 Hours 1 Min                0 Hours 0.1 Min.
bpatton       16           2 Hours 6 Min                0 Hours0.3Min.
bsharp        30          30 Hours 44 Min             1 Hours 1.4 Min.
bwilkin        10           3 Hours 58 Min             0 Hours 5.8Min.

Thanks in advance

John



Sun, 09 Jan 2000 03:00:00 GMT
 Align printed text output

On Wed, 23 Jul 1997 13:53:55 -0700, Jody Gelowitz

Quote:

>Use the TAB function instead of inserting spaces.  This is much more
>effective and more reliable.

>ie.  Printer.Print "NAME"; Tab(20); LOGINS; Tab(40); _
>    TOTAL LOGIN TIME; Tab(75); AVG LENGTH; Tab(85)

>Once that is done, if you want to align what is to go under "TOTAL LOGIN
>TIME", just type:

>    Printer.Print Tab(40); TotalLoginTime

>Later,
>Jody

 Thanks for the responses. The code worked fine

John



Mon, 10 Jan 2000 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. RE Align printed text output

2. Align printed text output

3. Aligning printed text output

4. VFP3.0: Ramdom shifting of aligned fields in Report output

5. How to direct output of PRINT to a text file

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

7. Print aligning

8. Help on aligning pre-printed forms with NEC Pinwriter P2000

9. Tabs not Aligning when Printed

10. Align result on text file

11. Aligning text in a multiline textbox

12. Paradox for Windows: report text align


 
Powered by phpBB® Forum Software