We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Print virtual grid into many grids

I have a virtual grid that displays a subset of data based on a tab control selection by the user in the GUI. When it''s time to print however, I need to print the grids for each tab, on sucessive pages. In other words, programatically print the first grid (possibly multiple pages - I have that part working), then simulate that the user clicked on the next tab, print that grid, 3rd tab, etc. In the GUI, when the user clicks a tab, I refresh the virtual grid, so it gets redrawn using the different underlying data. When printing however, can I continue a print flow (ev.HasMorePages = true), and somehow refresh the grid, causing the grid printing mechanism to start over at row 1 of the virtual grid for the next subset of data? Make any sense? Thanks!

4 Replies

AD Administrator Syncfusion Team August 26, 2004 05:13 AM UTC

If you want the printout to appear as on continuous flow (meaning row 1 of the second grid be displayed immediately under the last row of the first grid as if the two rows were in the same grid), then I think the simplest way to handle this is ''do a fake merge'' of all the grids into the first grid. If you want the second grid to start on its own page, then I would suggest just printing the second grid after the first grid has been completed by just restarting the print process again, for each subsequent grid. By a ''fake merge'', I mean setting a flag to indicate you are printing the grids. Then in your QueryCellInfo and QueryRowCount (and maybe QueryColCount), you can have a conditional case where you set the values as if the virtual datasource contains all three datasources. So, in QueryRowCount, the return value would be the sum of the rowcounts of the 3 datasources. In queryCellInfo, you would check the value of e.RowIndex and determine whether the value comes from datasource1, or datasource2 or datasource3, and set e.Style to the appropriate value from the appropriate datasource. (I think this sounds more complicated than it actually is when you start trying to do it.) Then when you start a print, you would set your flag, and call grid1.ResetVolatileData. This should trigger grid1 using the combined virtual datasources. After the print has finished, reset the flag and call resetvolatiledata again.


KG kgpsan September 24, 2004 06:45 AM UTC

Burch, can you please provide a sample for the above method which you have mentioned, Thanks in advance. Kgpsan >If you want the printout to appear as on continuous flow (meaning row 1 of the second grid be displayed immediately under the last row of the first grid as if the two rows were in the same grid), then I think the simplest way to handle this is ''do a fake merge'' of all the grids into the first grid. > >If you want the second grid to start on its own page, then I would suggest just printing the second grid after the first grid has been completed by just restarting the print process again, for each subsequent grid. > >By a ''fake merge'', I mean setting a flag to indicate you are printing the grids. Then in your QueryCellInfo and QueryRowCount (and maybe QueryColCount), you can have a conditional case where you set the values as if the virtual datasource contains all three datasources. So, in QueryRowCount, the return value would be the sum of the rowcounts of the 3 datasources. In queryCellInfo, you would check the value of e.RowIndex and determine whether the value comes from datasource1, or datasource2 or datasource3, and set e.Style to the appropriate value from the appropriate datasource. (I think this sounds more complicated than it actually is when you start trying to do it.) Then when you start a print, you would set your flag, and call grid1.ResetVolatileData. This should trigger grid1 using the combined virtual datasources. After the print has finished, reset the flag and call resetvolatiledata again. > >


AD Administrator Syncfusion Team September 24, 2004 07:29 PM UTC

Here is a sample that prints two grids as one using a virtual grid. Print2GridsAsOne_3573.zip


KG kgpsan September 27, 2004 02:20 AM UTC

Thanks, it worked fine.

Loader.
Live Chat Icon For mobile
Up arrow icon