Spread WPF Documentation
Providing a Print Preview
Spread WPF Documentation > Developer's Guide > Managing Data > Providing a Print Preview

You can preview the printed pages in a dialog. The Preview dialog allows you to zoom, display the entire page, or display multiple pages.

The Preview dialog has the following options:

Option Description
Zoom out or in Zoom the preview
100% Preview the page in the original size
Page Width Fit the page width to the largest viewport
Whole Page Preview and scale the page to make the the full page fit in the viewport
Two Pages Preview two pages in the viewport

Use the PrintPreview method to display the Preview dialog.

Using Code

This example sets the print properties and previews the sheet.

CS
Copy Code
GcSpreadSheet1.SheetCount = 3;
GcSpreadSheet1.Sheets[0].SetText(0, 0, "test");
GcSpreadSheet1.Sheets[1].SetText(0, 0, "Page test");
GcSpreadSheet1.Sheets[2].SetText(0, 0, "Page 3 test");
GrapeCity.Windows.SpreadSheet.Data.PrintInfo printset = new GrapeCity.Windows.SpreadSheet.Data.PrintInfo();
printset.ShowBorder = true;
printset.ShowColumnHeader = GrapeCity.Windows.SpreadSheet.Data.VisibilityType.Show;
printset.ShowRowHeader = GrapeCity.Windows.SpreadSheet.Data.VisibilityType.Show;
printset.ShowGridLine = true;
printset.FooterCenter = "This is Page &P";
GcSpreadSheet1.Sheets[0].PrintInfo = printset;          
GcSpreadSheet1.PrintPreview();
VB.NET
Copy Code
GcSpreadSheet1.SheetCount = 3
GcSpreadSheet1.Sheets(0).SetText(0, 0, "test")
GcSpreadSheet1.Sheets(1).SetText(0, 0, "Page test")
GcSpreadSheet1.Sheets(2).SetText(0, 0, "Page 3 test")
Dim printset As New GrapeCity.Windows.SpreadSheet.Data.PrintInfo()
printset.ShowBorder = True
printset.ShowColumnHeader = GrapeCity.Windows.SpreadSheet.Data.VisibilityType.Show
printset.ShowRowHeader = GrapeCity.Windows.SpreadSheet.Data.VisibilityType.Show
printset.ShowGridLine = True
printset.FooterCenter = "This is Page &P"
GcSpreadSheet1.Sheets(0).PrintInfo = printset
GcSpreadSheet1.PrintPreview()
See Also