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

I need to print some text information to be printed on the first page before the grid is printed. I want this information to be printed only on the first page. Kindly let me know the possible solution for this

5 Replies

AD Administrator Syncfusion Team July 19, 2005 03:01 AM

Here is a KB explaining how to print footers and headers. http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=62


AD Administrator Syncfusion Team July 19, 2005 03:30 AM

Clay, I need to print some test information before the grid. ITs not a header or a footer. I want it to be printed only on the first page. Suppose if the grid is printed in three or four pages, I want this test information to be printed in the first page. Thanks


AD Administrator Syncfusion Team July 19, 2005 03:48 AM

In that sample, you can choose to print or not print stuff in OnPrint based on the page number. So, you can print stuff on page one, but not print it on page 2,3,....
protected override void OnPrintPage(System.Drawing.Printing.PrintPageEventArgs ev)
{
	base.OnPrintPage(ev);

	if(pageNo == 1)
	{
		//.....
	}
	pageNo++;
}
This will be the simplest thing to do if it will serve your needs.


AD Administrator Syncfusion Team July 19, 2005 05:15 AM

I am adding this line to print some text before grid..but it overlaps with the gridcontrol if(pageNo == 1) ev.Graphics.DrawString(text, font, Brushes.Black, new RectangleF(x+25, y+25, w, h), format);


AD Administrator Syncfusion Team July 19, 2005 05:35 AM

Did you adjust the margines as in the sample?
public GridPrintAtLocDocument(GridControlBase grid, bool printPreview)
	: base(grid, printPreview)
{
	_grid = grid;

	headerHeight = 50;
	footerHeight = 20;

	int left = this.DefaultPageSettings.Margins.Left;
	int top = this.DefaultPageSettings.Margins.Top + headerHeight;  //50 lower
	int right = this.DefaultPageSettings.Margins.Right;
	int bottom = this.DefaultPageSettings.Margins.Bottom;
	this.DefaultPageSettings.Margins =  new Margins(left, right, top, bottom);

	pageNo = 1;
}

Loader.
Live Chat Icon For mobile
Up arrow icon