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
AD
Administrator
Syncfusion Team
February 18, 2004 04:03 PM UTC
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 04:53 PM UTC
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 05:47 PM UTC
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 07:08 PM UTC
Thank you!
ST
Steve
February 18, 2004 07:08 PM UTC
Thank you!
DO
Don
April 22, 2004 02:36 PM UTC
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))