New to Telerik UI for WinForms? Download free 30-day trial

Printing

Printing in RadSpreadsheet allows you to prepare and display spreadsheet data the most suitable way depending on your needs. Using different printing options such as defining the print page, the scale factor or whether to print grid-lines you may customize the way to present your data. Additionally Print Area and Page Breaks allows to print only what you need to print and separate big documents on pages just the way you want your data to be separated. Together with printing on a real printer, RadSpreadsheet’s printing gives you the opportunity to export your spreadsheet data in different file formats with the help of virtual printers.

This article aims to present the Printing API of RadSpreadsheet and demonstrate how to specify what and how to print the document. It contains the following subsections:

How to print RadSpreadsheet

RadSpreadsheet provides you with variety of options for organizing and preparing the document’s data for printing.

Using the PrintWhatSettings class you may specify:

  • ExportWhat option: Enumeration specifying whether to print the Active Sheet, the Entire Workbook or the current Selection.

  • IgnorePrintArea option: Boolean value indicating whether or not to ignore print area when printing worksheets.

Printing RadSpreadsheet is easily done through the Print method which prints according to some given PrintWhatSettings instance.

Depending on whether you want to show a print preview before printing you may use the PrintPreview method:

Print Methods

// Prints silently to the default printer without showing the print dialog.
var settings = new PrintWhatSettings(ExportWhat.ActiveSheet, false);
radSpreadsheet1.SpreadsheetElement.Print(settings);
// Prints showing the print dialog.
radSpreadsheet1.SpreadsheetElement.PrintPreview();

'Prints silently to the default printer without showing the print dialog.
Dim settings = New PrintWhatSettings(ExportWhat.ActiveSheet, False)
radSpreadsheet1.SpreadsheetElement.Print(settings)
'Prints showing the print dialog.
radSpreadsheet1.SpreadsheetElement.PrintPreview()

The bellow image shows the options available in the PrintPreview dialog.

The PrintPreview dialog

WinForms RadSpreadsheet PrintPreview dialog

Worksheet page setup

When you need to set different print option such as page size, page orientation or when you want to print the spreadsheet grid lines you may set this options using the worksheet's page setup. For more detailed information you may follow this link to WorksheetPageSetup documentation article.

You can apply headers and footers to the printed document. For more details on how to achieve this, refer to the Headers and Footers topic.

Ribbon UI

Our RadSpreadsheetRibbonBar allows you to print the current document as well. The print option is accessible from the application menu. In this case you have exactly the same options like in the PrintPreview dialog.

Printing from RadSpreadsheetRibbonBar

WinForms RadSpreadsheet Printing from RadSpreadsheetRibbonBar

See Also

In this article