Skip to main content
All docs
V23.2

Spreadsheet Print Preview Dialog

  • 5 minutes to read

The Print Preview dialog allows you to preview a spreadsheet document before it is printed. This dialog contains commands to print, navigate, customize, and export workbooks. You can also specify the document’s print settings (paper size, margins, scaling, page orientation, and so on) and view the document after these settings are applied.

Print Preview Dialog

Click the Print Preview button on the File tab of the Spreadsheet control’s Ribbon UI to invoke the Print Preview dialog. Refer to the following topic for information on how to create a spreadsheet application with the Ribbon UI: Create a Simple Spreadsheet Application.

Invoke the Print Preview Dialog

The Print Preview dialog contains the following Ribbon commands:

Commands of the Print Preview Dialog

You can use these commands to execute the following actions:

  • Print a document and set print options
  • Navigate through document pages
  • Search text within a document
  • Arrange document pages
  • Change the zoom level for the document preview
  • Specify the background color for document pages
  • Save a document as a PDF file or an image

At the bottom of the Print Preview dialog, you can set the document’s zoom level, and view the total number of pages and the current page number.

Commands at the Bottom of the Print Preview Dialog

The Print Settings Pane

The Print Settings pane allows you to customize print settings for a workbook. After you specify print settings, the Print Preview dialog displays the updated document preview.

When you invoke the Print Preview dialog, the Print Settings pane is displayed on the left side of the dialog. Click the Settings button on the Ribbon toolbar to hide or display this pane.

The Print Settings Pane

Specify Spreadsheet Content to Print

This option allows you to print the entire workbook or a specific portion of your document. Use the SpreadsheetPrintOptions.PrintContent property to programmatically specify spreadsheet content to print.

Specify Spreadsheet Content to Print

You can set this option to one of the following values:

Print Active Sheets
Prints the active sheet and all selected sheets. To select multiple sheets, hold CTRL and click sheet tabs in the Spreadsheet control’s sheet tab selector.
Print Entire Workbook
Prints all sheets in a workbook.
Print Selection
Prints the selected cell or cell range of the active sheet. If a chart sheet is active, all chart sheet content is printed.

Specify the Number of Copies and Page Range to Print

These options allow you to set the number of document copies and select the first and last page to print.

Specify the Number of Copies and Page Range

To define these options programmatically, create a PrinterSettings class instance, specify its PrinterSettings.Copies, PrinterSettings.FromPage, and PrinterSettings.ToPage properties, and pass the class instance to the SpreadsheetControl.Print method.

Collate Pages

If you print multiple copies, use this option to specify whether to collate document pages.

Collate Pages

To define this option programmatically, create a PrinterSettings class instance, specify its PrinterSettings.Collate property, and pass the class instance to the SpreadsheetControl.Print method.

Specify Page Orientation

This option allows you to specify orientation for printed pages. Use the SheetView.Orientation property to specify page orientation in code.

Specify Page Orientation

Specify Paper Size

This option allows you to select the paper size for printed pages. You can also click More Paper Sizes to invoke the Page Setup dialog and specify the paper size in this dialog. The Page Setup dialog contains additional print settings and allows you to add headers and footers to a worksheet, specify page orientation, paper size, margins, printout options, and so on.

Specify Paper Size

Use the SheetView.PaperKind property to specify one of the standard paper sizes programmatically. Call the SheetView.SetCustomPaperSize method to define a custom paper size for a sheet. After you customize the document paper size, the Print Settings pane displays the Custom Paper Size value for this option.

Specify Custom Paper Size

Specify Page Margins

This option allows you to select page margins. Use the SheetView.Margins property to specify the size of page margins in code.

Specify Page Margins

If you need to print a document with custom margins, you can click Custom Margins and specify page margins in the invoked Page Setup dialog. After you customize page margins, the Print Settings pane displays the Custom Margins value for this option.

Specify Custom Page Margins

Specify Page Scaling

Use this option to specify whether to scale worksheet content to fit a printed page.

Note

This option is not available for pages that contain chart sheets. Chart sheets are automatically scaled to the specified page size.

Specify Page Scaling

The following scaling options are available:

No Scaling
Scaling is not applied to a worksheet. Use the WorksheetPrintOptions.Scale property to programmatically specify the percentage used to scale worksheet content.
Fit Sheet on One Page
Scales a worksheet to print all data on one page. Use the WorksheetPrintOptions.FitToPage property to specify this option in code.
Fit All Columns on One Page
Scales a worksheet to print all data columns on one page. Use the WorksheetPrintOptions.FitToWidth property to specify this option in code.
Fit All Rows on One Page
Scales a worksheet to print all data rows on one page. Use the WorksheetPrintOptions.FitToHeight property to specify this option in code.

If you need to print a document with custom scaling options, click Custom Scaling Options and specify page scaling in the invoked Page Setup dialog. After you customize page scaling, the Print Settings pane displays the Custom Scaling value for this option.

Specify Custom Page Scaling

See Also