I have a grid that I would like to be able to print and also print preview. The grid may has many bands and expandable regions - these are not displayed properly when using the ultraPrintPreviewDialog control.
The call to wingrid.Print(displayLayout,printDoc) prints how I want it to (i.e. all rows including those not visible in collapsed regions) and also wingrid.PrintPreview(displayLayout,printDoc).
The problem with using PrintPreview() on the grid is that the viewer has a lot less functionality (and a win 95 look).
Is there a way to the displaylayout of the grid with the UltraPrintPreviewDialog so that it behaves in the same way as wingrid.Print() and wingrid.PrintPreview()?
Hi,
The PrintPreview method on the grid uses the MS PrintPreviewDialog control. If you want a more modern print preview look, I recommend you check out the UltraGridPrintDocument and the UltraPrintPreviewDialog components.
I am using the UltraPrintPreviewDialog - that's the problem. The print preview shows the grid as it appears on-screen, whereas the print preview on the grid shows all of the grid's columns and rows (I have groupings so some data is hidden in collapsed regions) - which is what I'm after. I presume this is because I cannot pass the displaylayout to the UltraPrintPreviewDialog (?). What I would like to know is if I can get the UltraPrintPreviewDialog to produce and print a preview with all of my grid's data, the same way that UltraGrid.PrintPreview() does.
Hi Crystal,
Handle the InitializeRow event of the grid. Inside this event, you can examine e.Row.Band.Layout.IsPrintLayout and this will tell you if the row is an on-screen row or a print row. Either way, you can simply set the Expanded property on the row. Setting the Expanded property on a print row will not affect the on-screen row and vice versa.
Hi
i had a serial number column in grid.
which shows rows in ascending order,
while print preview the grid shows the rows in random order( rows interchanged)
why the rows order interchanged in print preview.?
my coding is:
Dim pdSetup As New System.Drawing.Printing.PrintDocument()
Private Sub grdStockVerification_InitializeRow(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeRowEventArgs) Handles grdStockVerification.InitializeRow ' expand rows in band 0 Select Case e.Row.Band.Index Case 0 e.Row.Expanded = True End Select End Sub
Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click ' display grid in Print Preview pdSetup.DefaultPageSettings.Landscape = True grdStockVerification.PrintPreview(grdStockVerification.DisplayLayout, pdSetup) End Sub
What version of the controls are you using?
This sounds like a bug that we recently fixed. Getting the latest service release will probably fix it.
How to get the latest service release - Infragistics Community
i using the UltraGrid with the following version Infragistics2.Win.UltraWinGrid.v11.1
could you kindly give me a sample code for ultragrid printpreview.?
What kind of sample code are you looking for? Have you looked at the samples included in NetAdvantage?