Auto Paging
When a worksheet to be printed, ReoGrid performs the worksheet paging automatically. Paging operation scans the worksheet and decides the print range for every pages according to paging settings. For example, the following image shows a worksheet has been paged vertically.

Like as Excel, ReoGrid finds maximum number of cells in order to fill each pages, all cells that cannot be printed out entirely will be moved to next page, for example:

Perform auto paging or reset page breaks
Anytime to perform an auto paging or reset current existed page breaks:
sheet.AutoSplitPage();
This method itself works very fast(<10ms.), but it may be slowed down if a remote printer is set as default printer, to fetch the paper size from a remote printer will spend more than 100ms. (depends on the network environment)
Show page break lines
To show a page break lines on screen:
sheet.EnableSettings(WorksheetSettings.View_ShowPageBreaks);
Result:

Auto-check printable boundary
If there is no printable range specified, ReoGrid will find the used range of cells to set the printable range automatically.

Change printable range
Property PrintableRange of worksheet is used to change the printable range.
sheet.PrintableRange = new RangePosition(1, 1, 9, 9);

If the printable range is larger than the paper size, it will be split automatically. The cell outside the printable range will not be printed out.
Change paging order
Use PrintSettings.PageOrder property to change the paging direction.

sheet.PrintSettings.PageOrder = PrintPageOrder.DownThenOver;
Change page setting
Property PrintSettings of worksheet is used to change paper settings.
// change page to landscape
sheet.PrintSettings.Landscape = true;
// set page margins
sheet.PrintSettings.Margins = new PageMargins(5);
Example: Auto paging to landscape

Print Scaling
It is possible to set print scaling by using the property PageScaling of PrintSettings.
sheet.PrintSettings.PageScaling = 0.7f; // scale to 70%
When page scaling is changed, the worksheet will be re-paged automatically.
Insert a page break
To insert a page break by using RowPageBreaks and ColumnPageBreaks property of worksheet:
// insert page break
sheet.ColumnPageBreaks.Add(5);
Spreadsheet is split into two pages:

User page breaks and system page breaks
There is two types of page breaks, solid lines are the user page breaks, generated by AutoSplitPage method or user operations; dashed lines are the system page breaks, inserted by ReoGrid automatically to split worksheet into multiple page.

Change page breaks
To change/move an index of page break (whatever a system or user page break), use the following methods:
void sheet.ChangeColumnPageBreak(int oldIndex, int newIndex);
void sheet.ChangeRowPageBreak(int oldIndex, int newIndex);
Once a page break is changed, it will become to user page break and will not be updated by ReoGrid automatically.
Iterate pages
Method IteratePrintPage of worksheet is used to iterate over all print pages, this method returns the range position for every pages:
sheet.IteratePrintPages( range => {
Console.WriteLine("Page range is: " + range.ToAddress());
return true;
});
The result is printed out:
Page range is: A1:E11
Page range is: F1:K11
It is possible to iterate pages by specified order:
sheet.IteratePrintPages(PrintPageOrder.OverThenDown, range => { ... });
If no paging order is specified, the page order of print settings will be used.
Disable end-user changing/adjusting the page breaks
To disable end-user to change the page break index by mouse, set the worksheet settings:
sheet.SetSettings(WorksheetSettings.Behavior_AllowUserChangingPageBreaks, false);
Print Session
A print session used to print entire workbook or specified multiple worksheet. To print entire workbook or multiple worksheet, create print session from workbook instance (the control); To print single worksheet, create print session from that worksheet.

Print single worksheet
var session = worksheet.CreatePrintSession();
session.Print();
Print entire workbook (all worksheets)
var session = reoGridControl.CreatePrintSession();
session.Print();
Print specified worksheets
var session = reoGridControl.CreatePrintSession();
session.Worksheets.Clear();
session.Worksheets.Add(grid.Worksheets["Sheet1"]);
session.Worksheets.Add(grid.Worksheets["Sheet3"]);
session.Print();
Print Preview
The following code shows a .NET standard print preview dialog:
var sheet = reoGridControl.CurrentWorksheet;
using (var session = sheet.CreatePrintSession())
{
using (PrintPreviewDialog ppd = new PrintPreviewDialog())
{
ppd.Document = session.PrintDocument;
ppd.SetBounds(200, 200, 1024, 768);
ppd.PrintPreviewControl.Zoom = 1d;
ppd.ShowDialog(this);
}
}
The following code print worksheet with default print settings.
var session = sheet.CreatePrintSession();
session.Print();
Print via standard print dialog
The following code shows a standard print dialog then print specified worksheet.
System.Drawing.Printing.PrintDocument doc = null;
try
{
doc = worksheet.CreatePrintSession().PrintDocument;
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, this.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
using (var pd = new System.Windows.Forms.PrintDialog())
{
pd.Document = doc;
pd.UseEXDialog = true; // in 64bit Windows
if (pd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
doc.PrinterSettings = pd.PrinterSettings;
doc.Print();
}
}
if (doc != null) doc.Dispose();
Show system page settings dialog
using (PageSetupDialog psd = new PageSetupDialog())
{
// transform ReoGrid page settings to System page settings
psd.PageSettings = worksheet.PrintSettings.CreateSystemPageSettings();
psd.AllowMargins = true;
psd.AllowPrinter = true;
psd.AllowPaper = true;
psd.EnableMetric = true;
if (psd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// transform System page settings to ReoGrid page settings
worksheet.PrintSettings.ApplySystemPageSettings(psd.PageSettings);
}
}
Select printer programmatically
Use PrintSettings.PrinterName to send output directly to a specific printer without showing a dialog. Set it to null (the default) to use the system default printer.
sheet.PrintSettings.PrinterName = "Microsoft Print to PDF";
var session = sheet.CreatePrintSession();
session.Print();
Print grid lines
By default, grid lines are not printed. Set ShowGridLines to true to include them in the printed output.
sheet.PrintSettings.ShowGridLines = true;
Show margin indicators
When ShowMargins is true, margin boundary marks are drawn at the edges of each printed page (visible in print preview and in the printed output).
sheet.PrintSettings.ShowMargins = true;
Set paper size
Use PaperName to select from the predefined paper sizes. The string must match a key in PaperManager.PaperSizesInch.
Common values: "A3", "A4", "A5", "Letter", "Legal", "Ledger", "B4", "B5", "JIS_B4", "JIS_B5".
sheet.PrintSettings.PaperName = "A4";
When PaperName is set to a known size, PaperWidth and PaperHeight can be left at their defaults. Setting PaperName to "Custom" lets you specify the dimensions explicitly:
sheet.PrintSettings.PaperName = "Custom";
sheet.PrintSettings.PaperWidth = 6.0f; // inches
sheet.PrintSettings.PaperHeight = 9.0f; // inches
All sizes are in inches. The Landscape flag swaps width and height automatically when computing the printable area.
Available paper sizes
| Category | Names |
|---|---|
| ISO A series | A0 – A8 |
| ISO B series | B0 – B10 |
| ISO C series | C2 – C6 |
| JIS B series | JIS_B0 – JIS_B12 |
| North American | Letter, Legal, Ledger, Tabloid, Executive |
| ANSI | ANSI_C, ANSI_D, ANSI_E |
| Other | D0, SRA0 – SRA4, RA0 – RA2, Custom |
Set page margins
PageMargins stores four independent margin values in inches. Use the single-value constructor to set all four sides at once, or the four-value constructor for independent control.
// All four margins = 1 inch
sheet.PrintSettings.Margins = new PageMargins(1f);
// Top=0.5, Bottom=0.5, Left=1, Right=1 (inches)
sheet.PrintSettings.Margins = new PageMargins(0.5f, 0.5f, 1f, 1f);
// Adjust individual sides
var m = sheet.PrintSettings.Margins;
m.Left = 0.75f;
m.Right = 0.75f;
sheet.PrintSettings.Margins = m;
// Remove all margins
sheet.PrintSettings.Margins = PageMargins.Empty;
Reset all page breaks
Call ResetAllPageBreaks() to clear all user-defined breaks and re-run auto paging from scratch.
sheet.ResetAllPageBreaks();
This is equivalent to clearing PrintableRange, removing all entries from RowPageBreaks and ColumnPageBreaks, and calling AutoSplitPage().
PrintableRange changed event
Subscribe to PrintableRangeChanged to be notified whenever the printable range changes.
sheet.PrintableRangeChanged += (s, e) =>
{
Console.WriteLine("Printable range: " + sheet.PrintableRange.ToAddress());
};
PrintSettings property reference
| Property | Type | Default | Description |
|---|---|---|---|
PrinterName | string | null | Output printer name. null = system default. |
PaperName | string | "Letter" | Paper size name (key from PaperManager.PaperSizesInch). |
PaperWidth | float | 8.5f | Paper width in inches (used when PaperName is "Custom"). |
PaperHeight | float | 11f | Paper height in inches (used when PaperName is "Custom"). |
Landscape | bool | false | true for landscape orientation. |
Margins | PageMargins | new PageMargins(1f) | Page margins in inches. |
PageOrder | PrintPageOrder | DownThenOver | Page order: DownThenOver or OverThenDown. |
PageScaling | float | 1f | Scale factor (0.1 – 4.0). 1f = 100%. |
ShowGridLines | bool | false | Print cell grid lines. |
ShowMargins | bool | false | Draw margin boundary marks on pages. |