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

How to get the last page on print?

I will write something on the last page when on print ,bu how I can get the last page? and how to get the largest page number? thanks!

11 Replies

AD Administrator Syncfusion Team November 11, 2003 02:41 AM

If you override OnPrintPage in GridPrintDocument, you can test ev.HasMorePages to see if you are on the last page printed. Currently, there is no simple way to know in advance how may pages will be printed. Here is a sample that prints headers and footers with page numbers using an OnPrintPage override.

KI Kis November 11, 2003 06:42 PM

thanks Clay Burch. but I will draw some line on the last page ,the sample you supply me can ont get the last page.is has any ways to get it ?

AD Administrator Syncfusion Team November 12, 2003 12:49 AM

In your override on OnPrintPage, if ev.HasMorePages is false, then you are on the last page, and you can do the last page drawing at that point.

KI Kis November 12, 2003 09:39 PM

thanks !

KI Kis November 12, 2003 10:23 PM

I'm sorry ! how can I get the grid height in the last page??I will draw a line on the last row's bottom border

AD Administrator Syncfusion Team November 14, 2003 03:32 AM

I do not know of a good way to do this in general (locating the position on the print page of the last row). But if what you want to do is to draw a line on the border of the bottom row, you can do that from within the grid using PrepareViewStyleInfo.
private void gridControl1_PrepareViewStyleInfo(object sender, GridPrepareViewStyleInfoEventArgs e)
	if(this.gridControl1.PrintingMode && e.RowIndex == this.gridControl1.RowCount)
		e.Style.Borders.Bottom = new GridBorder(GridBorderStyle.Solid, Color.Red, GridBorderWeight.Thick);

KI Kis November 17, 2003 09:05 PM

thanks. But this is not I want to do ,I use gridcontrol to do a report ,and I fill report footer to the grid(the last row) .when printview it allways display a frame border with black ,so I want to cover it with a white line. but I don't know how to get the height of the last row when printview.

AD Administrator Syncfusion Team November 18, 2003 01:16 AM

I could not find a way to get the bottom of the grid in the OnPrintPage override. But you can get it in the PrepareViewStyleInfo event, and somehow make it available in OnPrintPage. Attached is a little sample using a static Form member to provide the value.

KI Kis November 18, 2003 05:19 PM

I don't know how to get it in the PrepareViewStyInfo event when it has multipage.and which sample did you point?

AD Administrator Syncfusion Team November 18, 2003 05:41 PM

Click the little disk download icon above my last response to get the sample. It has the PrepareViewStyleInfo event code in it.

KI Kis November 19, 2003 11:03 PM

It work well. thanks again!

Live Chat Icon For mobile
Up arrow icon