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. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Print multiple grid controls on one page

Thread ID:

Created:

Updated:

Platform:

Replies:

9458 Dec 18,2003 04:28 PM UTC Dec 20,2003 04:40 PM UTC WinForms 6
loading
Tags: GridControl
Doug
Asked On December 18, 2003 04:28 PM UTC

Is it possible to print multiple grid controls on a single page with a single click, one right after the other? I saw an example to print 2 grids to 2 different printouts, but I need them on the same printout. Thanks in advance for any help you can give me.

Administrator [Syncfusion]
Replied On December 18, 2003 08:19 PM UTC

This can be acheived by deriving the GridPrintDocument and overriding OnPrintPage Method. Here you can customize it according to your needs. Here is a sample.

Doug
Replied On December 19, 2003 11:05 AM UTC

Thanks a lot, that worked great!

Doug
Replied On December 19, 2003 11:51 AM UTC

After working with the printout a little more, I noticed that if i try to print a grid that is longer than a single page, it will only print the first page. Is there an easy way to get around this problem? Thanks for all your help.

Administrator [Syncfusion]
Replied On December 19, 2003 02:29 PM UTC

You can try using the baseclass to print the first grid, and then only print the second if there are no more pages of the first grid to print.
protected override void OnPrintPage(PrintPageEventArgs ev)
{
	base.OnPrintPage(ev);
	if(!ev.HasMorePages)
	{
		//set where you want the second grid displayed...
		int width = grid2.Model.ColWidths.GetTotal(0, grid2.Model.ColCount);
		int 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);
		//botGridRect.Inflate(1,1);
		ev.Graphics.DrawRectangle(Pens.Black, botGridRect);
	}
}

Doug
Replied On December 19, 2003 03:50 PM UTC

Does this mean it is not possible if both grids happen to be bigger than 1 page long? Thanks again.

Administrator [Syncfusion]
Replied On December 20, 2003 04:40 PM UTC

The sample was really intended to print grids that you know would fit on a single page. Currently, I do not know of a good way to continuously print several grids over several pages unless you allow each grid to start on its on page. We do intend to upgrade the printing support after we get the 2.0 version released, but I do not know a time frame for this additional support.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;