Export (0) Print
Expand All
Expand Minimize

Workbook.PrintPreview Method

Shows a preview of the object as it would look when printed.

Namespace: Microsoft.Office.Tools.Excel
Assembly: Microsoft.Office.Tools.Excel (in microsoft.office.tools.excel.dll)

public virtual void PrintPreview (
	[OptionalAttribute] Object EnableChanges
)

Parameters

EnableChanges

true to allow changes to the margins and page setup while displaying the print preview; otherwise, false.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example uses the PrintPreview method to show a print preview of the current workbook.

private void WorkbookPrintPreview()
{
    // Add a range value to make sure that the workbook generates 
    // a print preview. An empty workbook will not be printed.
    Globals.Sheet1.Range["A1", "A5"].Value2 = 55;
    this.PrintPreview(true);
}

Show:
© 2014 Microsoft