You may not want to print the entire sheet but only a specified range of cells on a sheet. You can specify that only a range of cells within a sheet prints, rather than the entire sheet. After specifying the range of cells with the PrintInfo object, use the PrintSheet method as described in Printing an Entire Sheet.
This example code prints cells B2 through D4.
C# |
Copy Code
|
---|---|
// Create PrintInfo object and set properties. FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo(); printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange; printset.ColStart = 1; printset.ColEnd = 3; printset.RowStart = 1; printset.RowEnd = 3; // Set the PrintInfo property for the first sheet. fpSpread1.Sheets[0].PrintInfo = printset; // Print the sheet. fpSpread1.PrintSheet(0); |
VB |
Copy Code
|
---|---|
' Create PrintInfo object and set properties. Dim printset As New FarPoint.Win.Spread.PrintInfo() printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange printset.ColStart = 1 printset.ColEnd = 3 printset.RowStart = 1 printset.RowEnd = 3 ' Set the PrintInfo property for the first sheet. fpSpread1.Sheets(0).PrintInfo = printset ' Print the sheet. fpSpread1.PrintSheet(0) |
This example code prints cells B2 through D4.
C# |
Copy Code
|
---|---|
// Create PrintInfo object and set properties. FarPoint.Win.Spread.PrintInfo printset = new FarPoint.Win.Spread.PrintInfo(); printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange; printset.ColStart = 1; printset.ColEnd = 3; printset.RowStart = 1; printset.RowEnd = 3; // Create SheetView object and assign it to the first sheet. FarPoint.Win.Spread.SheetView SheetToPrint = new FarPoint.Win.Spread.SheetView(); SheetToPrint.PrintInfo = printset; fpSpread1.Sheets[0] = SheetToPrint; // Print the sheet. fpSpread1.PrintSheet(0); |
VB |
Copy Code
|
---|---|
' Create PrintInfo object and set properties. Dim printset As New FarPoint.Win.Spread.PrintInfo() printset.PrintType = FarPoint.Win.Spread.PrintType.CellRange printset.ColStart = 1 printset.ColEnd = 3 printset.RowStart = 1 printset.RowEnd = 3 ' Create SheetView object and assign it to the first sheet. Dim SheetToPrint As New FarPoint.Win.Spread.SheetView() SheetToPrint.PrintInfo = printset fpSpread1.Sheets(0) = SheetToPrint ' Set the PrintInfo property for the first sheet. fpSpread1.Sheets(0).PrintInfo = printset ' Print the sheet. fpSpread1.PrintSheet(0) |
The Sheet Print Options dialog appears.