Printing a Sheet
Spread WinRT Documentation > Developer's Guide > Managing Data > Printing a Sheet

You can print the contents of a sheet to a printer with the Print method. You can specify footers, headers, orientation, borders, and many other options in the PrintInfo class.

The following table displays the options that can be used when creating a print header or footer:

Control Character Printed Header or Footer Action
P Inserts the current page number
N Inserts the total number of printed pages
D Inserts the date
T Inserts the time
G Inserts an image
S

Uses strikethrough in the font

U Uses underline in the font
B Uses a bold font
I Uses italics in the font
- NoneSpecified
\" FontPrefix
K ColorPrefix
F Inserts the name of the workbook (Name property)
A Inserts the name of the sheet (Name property)

Use the & symbol in front of the control character to specify an option in the above table. For example, &P inserts the current page number.

Multiple viewports, filter icons, and frozen row and column lines are not printed. Hidden rows and columns are not printed.

Most print settings are exported or imported from Excel. Properties in the PrintInfo class that are not imported or exported are BestFitColumns, BestFitRows, PageRange, ShowBorder, and UseMax. Images are not imported or exported.

Using Code

This example sets the print properties and prints the sheet.

CS
Copy Code
GrapeCity.Xaml.SpreadSheet.Data.PrintInfo printset = new GrapeCity.Xaml.SpreadSheet.Data.PrintInfo();
printset.FitPagesTall = 1;
printset.FitPagesWide = 1;
printset.ShowBorder = true;
printset.ShowColumnHeader = GrapeCity.Xaml.SpreadSheet.Data.VisibilityType.Show;
printset.ShowRowHeader = GrapeCity.Xaml.SpreadSheet.Data.VisibilityType.Show;
printset.ShowGridLine = true;
gcSpreadSheet1.Sheets[0].PrintInfo = printset;
gcSpreadSheet1.Print();
VB
Copy Code
Dim printset As New GrapeCity.Xaml.SpreadSheet.Data.PrintInfo()
printset.FitPagesTall = 1
printset.FitPagesWide = 1
printset.ShowBorder = True
printset.ShowColumnHeader = GrapeCity.Xaml.SpreadSheet.Data.VisibilityType.Show
printset.ShowRowHeader = GrapeCity.Xaml.SpreadSheet.Data.VisibilityType.Show
printset.ShowGridLine = True
GcSpreadSheet1.Sheets(0).PrintInfo = printset
GcSpreadSheet1.Print()