Printing from a FlexGrid

I want to print the contents of most of a flex grid (all but the top row),in addition to a heading (One line, large text), and column headings. The contents of the flexgrid and the column headings need to be aligned, and preferably I need divider lines between them. I have looked at the printer object but have had no success, particularaly in regards to positioning text. Help!
Arachn1dAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VbmasterCommented:
Positioning text can be done using the .CurrentX and .CurrentY properties, for example if you want to position the text "What to type here" with the beginning at the coordinates (10 , 20) you just code..

Printer.CurrentX = 10
Printer.CurrentY = 20
Printer.Print "What to type here"

The printer object uses the same scale object model that any other control/form VB has, so to get the coordinates in something easier to understand you can set it to millimeters using code like

Printer.ScaleMode = vbMillimeters

If you add this code before the three code lines above you will get the "What to type here" string printed 10 mm from the left side of the paper and 20 mm from the top border of the paper.

Well not exactly 10mm and 20mm, printers do have a internal limitation so it might be 15mm and 25mm because the printer adds it's own margins to those values.
0
watyCommented:
' #VBIDEUtils#************************************************************
' * Programmer Name  : Waty Thierry
' * Web Site         : www.geocities.com/ResearchTriangle/6311/
' * E-Mail           : waty.thierry@usa.net
' * Date             : 29/04/99
' * Time             : 13:26
' **********************************************************************
' * Comments         : Print MSFlexGrid
' *
' *
' **********************************************************************

Public Sub MSFlexGridPrint(gridQuery As Control)
   ' *** Print MSFlexGrid

   Dim I          As Integer
   Dim J          As Integer
   Dim PTab       As Integer

   For I = 1 To gridQuery.Rows - 1
      PTab = 20 'Set the first tab value
      'This checks to see if a page break is needed

      If Printer.CurrentY + Printer.TextHeight(gridQuery.Text) > Printer.ScaleHeight - 600 Then
         Printer.NewPage
      End If

      gridQuery.Row = I 'Set the active row

      For J = 0 To gridQuery.Cols - 1
         gridQuery.Col = J 'Set the current column
         
         'Send the field to the print line and add the tab.
         'Notice the semicolon at the end of the line.

         Printer.Print Trim$(gridQuery.Text); Tab(PTab);

         PTab = PTab + 20 'Increment the tab value
      Next

      'After each column has printed to the print line

      'a Printer.Print statement without a semicolon will
      'will send the line to the printer and start a new
      'one.
      Printer.Print
   Next

End Sub  

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Arachn1dAuthor Commented:
Thanks anyway, but I figured it out myself and forgot to delete the question. Here's the points anyway since your answer also seems to answer the question quite satisfactorially.

Thanks.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.