Spread Windows Forms 10.0 Product Documentation > Developer's Guide > Managing Printing > Specifying What to Print > Printing an Area of the Sheet |
You may not want to print the entire sheet but only a specified area of the sheet. You can specify an area of the sheet with the PrintType property of the PrintInfo object or use the OwnerPrintDraw method for the control. As with the other printing tasks, such as Printing an Entire Sheet, this involves the PrintSheet method.
Set the PrintType property and use the PrintSheet method to print.
This example specifies an area to print.
C# |
Copy Code
|
---|---|
// Create the printer settings object FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo(); // Allow printing of only 20 columns and 20 rows of cells printset.ColStart = 1; printset.ColEnd = 20; printset.RowStart = 1; printset.RowEnd = 20; printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange; // Assign the printer settings to the sheet and print it fpSpread1.Sheets[0].PrintInfo = printset; fpSpread1.PrintSheet(0); |
VB |
Copy Code
|
---|---|
Dim printset As New FarPoint.Win.Spread.PrintInfo ' Allow printing of only 20 columns and 20 rows of cells printset.ColEnd = 20 printset.ColStart = 1 printset.RowStart = 1 printset.RowEnd = 20 printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange ' Assign the printer settings to the sheet and print it FpSpread1.Sheets(0).PrintInfo = printset FpSpread1.PrintSheet(0) |