Click to See Complete Forum and Search --> : Flexgrid Printing


Tina
February 25th, 2000, 09:10 AM
Any suggestion on how I can print the contents of a flexgrid ?
Right now when I print it, it is printing the form and not the whole of the grid is printed out.

Thanks !

Aaron Young
February 25th, 2000, 11:45 AM
If you want a Graphical representation of ALL Rows/Columns in the Grid, then use the FlexGrids Picture Property, ie.
Printer.PaintPicture MSFlexGrid1.Picture, 0, 0
Printer.EndDoc


Otherwise you'll need to Traverse the contents of the Grid yourself Sending each Cell/Row to the Printer One at a Time.

Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com
Certified AllExperts Expert: http://www.allexperts.com/displayExpert.asp?Expert=11884

Tina
February 25th, 2000, 01:27 PM
Can you set the page margins ?
Also, the Grid is too big to fit in one page.
Is there any way I can make it fit in a page or have it print the rest in the next page?

Aaron Young
February 25th, 2000, 01:57 PM
You could certainly rescale the Image to fit the Page, ie.
private Sub Command1_Click()
Dim W as Single
Dim H as Single

With Printer
W = ScaleX(MSFlexGrid1.Picture.Width, vbHimetric, .ScaleMode)
H = ScaleY(MSFlexGrid1.Picture.Height, vbHimetric, .ScaleMode)
If W > .ScaleWidth Or H > .ScaleHeight then
'Make the Image Fit the Printed Page..
.PaintPicture MSFlexGrid1.Picture, 0, 0, IIf(W > .ScaleWidth, .ScaleWidth, W), IIf(H > .ScaleHeight, .ScaleHeight, H), 0, 0, W, H
else
.PaintPicture MSFlexGrid1.Picture, 0, 0
End If
.EndDoc
End With
End Sub



Aaron Young
Analyst Programmer
ajyoung@pressenter.com
aarony@redwingsoftware.com
Certified AllExperts Expert: http://www.allexperts.com/displayExpert.asp?Expert=11884