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 Ranges

How can I specify a print range, or more specifically set the print range to only include the right most columns that contain data? For example, when I look at the Grid Pad example, and press print preview, how can I specify a certain number of pages, or better yet the number of pages that exist? Thanks Steve

6 Replies

AD Administrator Syncfusion Team February 18, 2004 11:03 AM

If you only want to print certain columns/rows, then handle the QueryColWidth/QueryRowHeights event(s). In your event handler, if e.Index point to a col/row that you don''t want to print and if grid.PrintingMode is true, then set e.Size = 0. This will essentially hide any col/row you don''t want to see. Here is a KB link that prints a footer showing the page count 1 of xx. It gets the page count from teh printersettings.maximumpages property. http://www.syncfusion.com/Support/article.aspx?id=10376


ST Steve February 18, 2004 11:53 AM

Is there a way to simply specify a print range, say I want to print cells 1,1 to 5,5.


AD Administrator Syncfusion Team February 18, 2004 12:47 PM

If you have cells selected in the grid, you can print them with code like: GridPrintDocument pd = new GridPrintDocument(this.gridControl1, true); PrintPreviewDialog dlg = new PrintPreviewDialog() ; pd.PrinterSettings.PrintRange = System.Drawing.Printing.PrintRange.Selection; dlg.Document = pd; dlg.ShowDialog(); If you need to select the cells from code, you can add code like: this.gridControl1.Selections.Add(GridRangeInfo.Cells(1,1,5,5));


ST Steve February 18, 2004 02:08 PM

Thank you!


ST Steve February 18, 2004 02:08 PM

Thank you!


DO Don April 22, 2004 10:36 AM

I'd just like to add that the following line of code given above: this.gridControl1.Selections.Add(GridRangeInfo.Cells(1,1,5,5)); did not work for me, but this code did: this.gridControl1.Selections.Ranges.Add(GridRangeInfo.Cells(1, 1, 5, 5))

Loader.
Live Chat Icon For mobile
Up arrow icon