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 !
Printable View
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 !
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
[email protected]
[email protected]
Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
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?
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
[email protected]
[email protected]
Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884