Results 1 to 15 of 15

Thread: [RESOLVED] Text File Column Alignment While Printing

Threaded View

  1. #1

    Thread Starter
    Frenzied Member toecutter's Avatar
    Join Date
    Apr 2006
    Location
    Brisbane, Australia
    Posts
    1,160

    Resolved [RESOLVED] Text File Column Alignment While Printing

    I have got my text file sorted into 5 columns and it looks good



    using this code
    Code:
                Dim sw As New IO.StreamWriter("C:\StickFrameExpress\Jobs\" & Me.lblJobNumber.Text & ".txt", False)
                'write blanks lines
                sw.WriteLine("")
                sw.WriteLine("")
                'write job number and date
                sw.WriteLine(ControlChars.Tab & "Job Number:" & "  " & Me.lblJobNumber.Text & "                                     " & Now)
                sw.WriteLine("")
                sw.WriteLine("")
                sw.WriteLine("")
                'header
                sw.WriteLine(ControlChars.Tab & "Name".PadRight(20, " "c) & _
                                  ControlChars.Tab & "Material".PadRight(50, " "c) & _
                                  ControlChars.Tab & "Length".PadRight(15, " "c) & _
                                  ControlChars.Tab & "Qty".PadRight(8, " "c) & _
                                  ControlChars.Tab & "Units".PadRight(8, " "c)) 
                   sw.WriteLine("")
                Dim i As Int16
                With Me.ListView1
                    For i = 0 To CShort(.Items.Count - 1)
                        If .Items(i).Text <> "" Then
                            sw.WriteLine(ControlChars.Tab & .Items(i).Text.PadRight(20, " "c) & _
                                              ControlChars.Tab & .Items(i).SubItems(1).Text.PadRight(50, " "c) & _
                                              ControlChars.Tab & .Items(i).SubItems(2).Text.PadRight(15, " "c) & _
                                              ControlChars.Tab & .Items(i).SubItems(3).Text.PadRight(8, " "c) & _
                                              ControlChars.Tab & .Items(i).SubItems(4).Text.PadRight(8, " "c)) 
                          sw.writeLine("")
    When i print the file using the file > print from the notepad program the columns do not appear as they do on the screen..

    They no longer line up.
    How can i overcome this?

    regards
    toe
    Last edited by toecutter; Apr 13th, 2008 at 01:01 AM. Reason: Title

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width