Spread Windows Forms 9.0 Product Documentation
Printing an Entire Sheet

You can print a sheet in the component with the FpSpread.PrintSheet method. Use this method to print the sheet or sheets, using the PrintInfo settings for each sheet. You can only print one sheet in the component at a time; each sheet can have its own PrintInfo object, but you can call the PrintSheet method once to do one or all of the sheets. If the sheet parameter is set to -1, all the sheets in the Spread component print, with each sheet (with its individual PrintInfo settings) as a separate print job. The PrintDocument event occurs when printing a sheet.

The default setting prints in black and white and automatically determines the best order in which to print pages. With the default settings, the following items print using the printer’s current orientation setting:

To customize these settings, refer to Understanding the Printing Options and Customizing the Printed Page Header or Footer. To allow Spread to determine the best print settings, refer to Optimizing the Printing Using Rules.

You can call PrintSheet with different sheet parameters one after the other but calling PrintSheet on the same sheet without waiting for the initial print to conclude could produce incorrect results. Before calling the next print for a given sheet, you need to wait for the previous one to be finished. You can do this by catching the PrintMessageBox event and querying the BeginPrinting parameter to see if it is False.

You can also use the Spread Designer to set properties for printing, and you can print directly from the Spread Designer. For more information, refer to Printing a Sheet from Spread Designer.

Using Code

Use the PrintSheet method in the FpSpread class to print the specified sheet.

Example

This example code prints the second sheet in the component.

C#
Copy Code
fpSpread1.PrintSheet(1);
VB
Copy Code
FpSpread1.PrintSheet(1)
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback