Hi,
I've seen the code from the example but what I want to do is a little bit different.
What i want to do is to print diffent grids into the same print document. Let's say I have two grids Grid1 and Grid2. Grid1 occupies a page and a half, Grid2 occupies two pages. I want to print all Grid1, that occupies a page and half, and then in the same page start printing Grid2 CALLING THE BASE.PRINT() METHOD of the grids.
I've already figured out how to print the grids one after the other, the problems is that when I print Grid2 the print start a the top of the page even if I change the Margin.Top proprieties of the printPageEventArgs.
>Hi Me,
You can print two or more grids in a same page by deriving the GridPrintDocument and overriding its OnPrintPage method. In the override, don't call the base class.
Please refer the code snippets:
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs ev)
{
//don not call baseclass...
//set where you want the grid displayed...
int width = grid1.Model.ColWidths.GetTotal(0, grid1.Model.ColCount);
int height = grid1.Model.RowHeights.GetTotal(0, grid1.Model.RowCount);
Rectangle topGridRect = new Rectangle(ev.MarginBounds.Left, ev.MarginBounds.Top, width, height);
grid1.DrawGrid(ev.Graphics, topGridRect, false);
ev.Graphics.DrawRectangle(Pens.Black, topGridRect);
//set where you want the second grid displayed...
width = grid2.Model.ColWidths.GetTotal(0, grid2.Model.ColCount);
height = grid2.Model.RowHeights.GetTotal(0, grid2.Model.RowCount);
Rectangle botGridRect = new Rectangle(ev.MarginBounds.Left, ev.PageBounds.Height/2, width, height);
grid2.DrawGrid(ev.Graphics, botGridRect, false);
ev.Graphics.DrawRectangle(Pens.Black, botGridRect);
}
Please refer the sample which implements the above said feature
http://websamples.syncfusion.com/samples/Grid.Windows/F69407/main.htm Kindly let us know if you need any further assistance.
Thank you for using Syncfusion Products.
Best Regards,
Jeba.