Announcement

Collapse
No announcement yet.

Printing columns and rows of data problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • James Matt
    replied
    Philip,

    That was it. Needed to set the Scale. Now it formats properly.

    Thanks for the help, Jim

    Leave a comment:


  • Philip Zeller
    replied
    I got it

    I was misunderstanding the original post. I was thinking it wasn't progressing "down the page", but it sounds like it wasn't progressing over (right).

    Now that I understand the question better, it occurs to me that the MLG (my little grid) control is probably giving you width in pixels (relative to the screen).

    You'll either need to xprint scale, or multiply out to get the proper position on the printer, since it has WAY more resolution. Make sense?

    Of course, I haven't used MLG, this is just my theory.

    Leave a comment:


  • James Matt
    replied
    Hi Philip,

    It's good to hear it works for someone, if not me.

    My one and only printer is a HP 4215, couple years old, and I never had a problem with it using VB6.

    I wrote lots of the x data to a text file. It was all over the place. The W! value incremented as it was supposed to; in step with the column widths. But the x value sequentially increased then decreased all the way through the columns for every row.

    Yes, XPrint worked fine in my tests too. Rows incremented fine but all the columns printed near the left margin.

    I'll keep playing with it and hope, in the mean time, someone comes up with a reason for this behavior.

    Jim

    Leave a comment:


  • Philip Zeller
    replied
    It's working here

    The code you've posted works (modified to just print the letter 'A') using PB/Win 9.

    Have you tried a different printer?

    Also, for diagnosis, you may wish to write to a log the X! and Y! values after each call to XPRINT GET POSITION. Perhaps, log R,C,X!,Y! on each iteration to a text file. This might provide more information.

    You are correct, calling XPRINT by itself is meant to drop to the next line, and should increase your Y! (it does for me).

    P.S. For testing, instead of using paper, I'm printing to PrimoPDF and viewing the PDF file. Saves paper!

    Leave a comment:


  • James Matt
    replied
    Hi Edwin,

    y should be increased by the lone XPrint statement executed after printing all the columns in a line. Then just before executing the Set Pos for the next line I do a Get Pos command which should get the new y.

    Jim

    Leave a comment:


  • Edwin Knoppert
    replied
    You never seem to reset y!
    On each new row you'll need to increase y!

    Leave a comment:


  • James Matt
    started a topic Printing columns and rows of data problem

    Printing columns and rows of data problem

    Hi,

    This is my first time using printer commands and I'm having trouble printing the row, column text from a grid.
    It overprints all the columns on each row. (prints each columns text over the previous one)
    Code:
            Local R as Long, C as Long
            ERRCLEAR
            XPrint Attach Choose
            If Err = 0 And Len(XPrint$) > 0 Then
                    XPrint Color RGB(0, 0 ,0) ' Black
                    For R = 1 To 50
                            W! = 0
                            For C = 1 To 8
                                    XPrint MLG_Get(HWND_FORM1_Grid1, R, C);   'print text from grid location r, c and stay on same line
                                    W! = W! + SendMessage (HWND_FORM1_Grid1, %MLG_GETCOLWIDTH, C, 0)   'compute next x position
                                    XPrint Get Pos To x!, y!   'get the y value
                                    XPrint Set Pos (W!, y!)   'set the x and y position to print next column
                            Next C
                            XPrint   'drop to next line
                            If MLG_Get(HWND_FORM1_Grid1,R + 1,1) = "" Then Exit For   'if no text in next line then exit the loop
                    Next R    
                    XPrint FormFeed
                    XPrint Close
            End If
    Any help will be appreciated.

    Jim
    Last edited by Gary Beene; 25 Jul 2014, 11:27 PM. Reason: Code: tags
Working...
X